diff --git a/.gitignore b/.gitignore index 496ee2ca..47f36f65 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.DS_Store \ No newline at end of file +.DS_Store +vendor \ No newline at end of file diff --git a/.php_cs b/.php_cs deleted file mode 100755 index 6b8e23c8..00000000 --- a/.php_cs +++ /dev/null @@ -1,18 +0,0 @@ -level(Symfony\CS\FixerInterface::PSR2_LEVEL) - ->setUsingCache(true) - ->fixers( - [ - 'ordered_use', - 'phpdoc_order', - 'short_array_syntax', - 'strict', - 'strict_param' - ] - ) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__) - ); diff --git a/.travis.yml b/.travis.yml index d77f3825..d4598872 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ language: php sudo: false php: - - 5.4 - - 5.5 - 5.6 - 7.0 - hhvm diff --git a/README.md b/README.md index d7d2db47..9d6ca5b1 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ For more information, please visit [https://account.sendinblue.com/support](http ## Requirements -PHP 5.4.0 and later +PHP 5.6 and later ## Installation & Usage ### Composer @@ -42,7 +42,7 @@ Then run `composer install` Download the files and include `autoload.php`: ```php - require_once('/path/to/APIv3-php-library/autoload.php'); + require_once('/path/to/APIv3-php-library/vendor/autoload.php'); ``` ## Tests @@ -63,14 +63,19 @@ Please follow the [installation procedure](#installation--usage) and then run th require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -$api_instance = new SendinBlue\Client\Api\AccountApi(); +$apiInstance = new SendinBlue\Client\Api\AccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); try { - $result = $api_instance->getAccount(); + $result = $apiInstance->getAccount(); print_r($result); } catch (Exception $e) { echo 'Exception when calling AccountApi->getAccount: ', $e->getMessage(), PHP_EOL; @@ -249,7 +254,6 @@ Class | Method | HTTP request | Description - [GetEmailEventReportEvents](docs/Model/GetEmailEventReportEvents.md) - [GetExtendedCampaignOverviewSender](docs/Model/GetExtendedCampaignOverviewSender.md) - [GetExtendedCampaignStats](docs/Model/GetExtendedCampaignStats.md) - - [GetExtendedCampaignStatsLinksStats](docs/Model/GetExtendedCampaignStatsLinksStats.md) - [GetExtendedClientAddress](docs/Model/GetExtendedClientAddress.md) - [GetExtendedContactDetailsStatistics](docs/Model/GetExtendedContactDetailsStatistics.md) - [GetExtendedContactDetailsStatisticsClicked](docs/Model/GetExtendedContactDetailsStatisticsClicked.md) diff --git a/autoload.php b/autoload.php deleted file mode 100755 index 2869686b..00000000 --- a/autoload.php +++ /dev/null @@ -1,54 +0,0 @@ -=5.4", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", - "ext-mbstring": "*" + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^6.2" }, "require-dev": { - "phpunit/phpunit": "~4.8", - "satooshi/php-coveralls": "~1.0", + "phpunit/phpunit": "^4.8", "squizlabs/php_codesniffer": "~2.6", "friendsofphp/php-cs-fixer": "~1.12" }, @@ -37,7 +37,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.0.x-dev" + "dev-master": "6.0.x-dev" } } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..c96f5981 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2057 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "5a8d4cfcd6544d7f0da7631f6d440a51", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14T21:17:01+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v1.13.3", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "387e4c86c9dc0e1e4c475291fc114ec45b98e624" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/387e4c86c9dc0e1e4c475291fc114ec45b98e624", + "reference": "387e4c86c9dc0e1e4c475291fc114ec45b98e624", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^5.3.6 || >=7.0 <7.2", + "sebastian/diff": "^1.1", + "symfony/console": "^2.3 || ^3.0", + "symfony/event-dispatcher": "^2.1 || ^3.0", + "symfony/filesystem": "^2.1 || ^3.0", + "symfony/finder": "^2.1 || ^3.0", + "symfony/process": "^2.3 || ^3.0", + "symfony/stopwatch": "^2.5 || ^3.0" + }, + "conflict": { + "hhvm": "<3.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.5|^5", + "satooshi/php-coveralls": "^1.0" + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "Symfony\\CS\\": "Symfony/CS/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dariusz RumiƄski", + "email": "dariusz.ruminski@gmail.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "time": "2017-09-11T14:11:16+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2", + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-10T14:09:06+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.7.6", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-04-18T13:57:24+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06T15:47:00+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.12", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-12-04T08:55:13+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.36", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.2.2", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2017-06-21T08:07:12+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02T06:51:40+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "sebastian/comparator", + "version": "1.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-01-29T09:50:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-05-22T07:24:03+00:00" + }, + { + "name": "sebastian/environment", + "version": "1.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-08-18T05:49:44+00:00" + }, + { + "name": "sebastian/exporter", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-06-17T09:04:28+00:00" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12T03:26:01+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2016-10-03T07:41:43+00:00" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21T13:59:46+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.9.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-05-22T02:43:20+00:00" + }, + { + "name": "symfony/console", + "version": "v3.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "36f83f642443c46f3cf751d4d2ee5d047d757a27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/36f83f642443c46f3cf751d4d2ee5d047d757a27", + "reference": "36f83f642443c46f3cf751d4d2ee5d047d757a27", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log-implementation": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-05-16T08:49:21+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "b28fd73fefbac341f673f5efd707d539d6a19f68" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/b28fd73fefbac341f673f5efd707d539d6a19f68", + "reference": "b28fd73fefbac341f673f5efd707d539d6a19f68", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2018-05-16T14:03:39+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fdd5abcebd1061ec647089c6c41a07ed60af09f8", + "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2018-04-06T07:35:25+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "8e03ca3fa52a0f56b87506f38cf7bd3f9442b3a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8e03ca3fa52a0f56b87506f38cf7bd3f9442b3a0", + "reference": "8e03ca3fa52a0f56b87506f38cf7bd3f9442b3a0", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2018-05-16T08:49:21+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "472a92f3df8b247b49ae364275fb32943b9656c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/472a92f3df8b247b49ae364275fb32943b9656c6", + "reference": "472a92f3df8b247b49ae364275fb32943b9656c6", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-05-16T08:49:21+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-04-30T19:57:29+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "3296adf6a6454a050679cde90f95350ad604b171" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", + "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-04-26T10:06:28+00:00" + }, + { + "name": "symfony/process", + "version": "v3.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "4cbf2db9abcb01486a21b7a059e03a62fae63187" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/4cbf2db9abcb01486a21b7a059e03a62fae63187", + "reference": "4cbf2db9abcb01486a21b7a059e03a62fae63187", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-05-16T08:49:21+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v3.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/eb17cfa072cab26537ac37e9c4ece6c0361369af", + "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2018-02-17T14:55:25+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c5010cc1692ce1fa328b1fb666961eb3d4a85bb0", + "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-05-03T23:18:14+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.6", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*" + }, + "platform-dev": [] +} diff --git a/docs/Api/AccountApi.md b/docs/Api/AccountApi.md index 8a21dc39..6262f897 100644 --- a/docs/Api/AccountApi.md +++ b/docs/Api/AccountApi.md @@ -18,14 +18,19 @@ Get your account informations, plans and credits details require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -$api_instance = new SendinBlue\Client\Api\AccountApi(); +$apiInstance = new SendinBlue\Client\Api\AccountApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); try { - $result = $api_instance->getAccount(); + $result = $apiInstance->getAccount(); print_r($result); } catch (Exception $e) { echo 'Exception when calling AccountApi->getAccount: ', $e->getMessage(), PHP_EOL; diff --git a/docs/Api/AttributesApi.md b/docs/Api/AttributesApi.md index b064b8f5..e3b96556 100644 --- a/docs/Api/AttributesApi.md +++ b/docs/Api/AttributesApi.md @@ -21,17 +21,22 @@ Creates contact attribute require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\AttributesApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\AttributesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $attributeCategory = "attributeCategory_example"; // string | Category of the attribute $attributeName = "attributeName_example"; // string | Name of the attribute $createAttribute = new \SendinBlue\Client\Model\CreateAttribute(); // \SendinBlue\Client\Model\CreateAttribute | Values to create an attribute try { - $api_instance->createAttribute($attributeCategory, $attributeName, $createAttribute); + $apiInstance->createAttribute($attributeCategory, $attributeName, $createAttribute); } catch (Exception $e) { echo 'Exception when calling AttributesApi->createAttribute: ', $e->getMessage(), PHP_EOL; } @@ -72,16 +77,21 @@ Deletes an attribute require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\AttributesApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\AttributesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $attributeCategory = "attributeCategory_example"; // string | Category of the attribute $attributeName = "attributeName_example"; // string | Name of the existing attribute try { - $api_instance->deleteAttribute($attributeCategory, $attributeName); + $apiInstance->deleteAttribute($attributeCategory, $attributeName); } catch (Exception $e) { echo 'Exception when calling AttributesApi->deleteAttribute: ', $e->getMessage(), PHP_EOL; } @@ -121,14 +131,19 @@ Lists all attributes require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -$api_instance = new SendinBlue\Client\Api\AttributesApi(); +$apiInstance = new SendinBlue\Client\Api\AttributesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); try { - $result = $api_instance->getAttributes(); + $result = $apiInstance->getAttributes(); print_r($result); } catch (Exception $e) { echo 'Exception when calling AttributesApi->getAttributes: ', $e->getMessage(), PHP_EOL; @@ -165,17 +180,22 @@ Updates contact attribute require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\AttributesApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\AttributesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $attributeCategory = "attributeCategory_example"; // string | Category of the attribute $attributeName = "attributeName_example"; // string | Name of the existing attribute $updateAttribute = new \SendinBlue\Client\Model\UpdateAttribute(); // \SendinBlue\Client\Model\UpdateAttribute | Values to update an attribute try { - $api_instance->updateAttribute($attributeCategory, $attributeName, $updateAttribute); + $apiInstance->updateAttribute($attributeCategory, $attributeName, $updateAttribute); } catch (Exception $e) { echo 'Exception when calling AttributesApi->updateAttribute: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/ContactsApi.md b/docs/Api/ContactsApi.md index ce25eadb..4e74069c 100644 --- a/docs/Api/ContactsApi.md +++ b/docs/Api/ContactsApi.md @@ -43,16 +43,21 @@ Add existing contacts to a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list $contactEmails = new \SendinBlue\Client\Model\AddContactToList(); // \SendinBlue\Client\Model\AddContactToList | Emails addresses of the contacts try { - $result = $api_instance->addContactToList($listId, $contactEmails); + $result = $apiInstance->addContactToList($listId, $contactEmails); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->addContactToList: ', $e->getMessage(), PHP_EOL; @@ -93,17 +98,22 @@ Creates contact attribute require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $attributeCategory = "attributeCategory_example"; // string | Category of the attribute $attributeName = "attributeName_example"; // string | Name of the attribute $createAttribute = new \SendinBlue\Client\Model\CreateAttribute(); // \SendinBlue\Client\Model\CreateAttribute | Values to create an attribute try { - $api_instance->createAttribute($attributeCategory, $attributeName, $createAttribute); + $apiInstance->createAttribute($attributeCategory, $attributeName, $createAttribute); } catch (Exception $e) { echo 'Exception when calling ContactsApi->createAttribute: ', $e->getMessage(), PHP_EOL; } @@ -144,15 +154,20 @@ Create a contact require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $createContact = new \SendinBlue\Client\Model\CreateContact(); // \SendinBlue\Client\Model\CreateContact | Values to create a contact try { - $result = $api_instance->createContact($createContact); + $result = $apiInstance->createContact($createContact); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL; @@ -192,15 +207,20 @@ Create a folder require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $createFolder = new \SendinBlue\Client\Model\CreateUpdateFolder(); // \SendinBlue\Client\Model\CreateUpdateFolder | Name of the folder try { - $result = $api_instance->createFolder($createFolder); + $result = $apiInstance->createFolder($createFolder); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->createFolder: ', $e->getMessage(), PHP_EOL; @@ -240,15 +260,20 @@ Create a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $createList = new \SendinBlue\Client\Model\CreateList(); // \SendinBlue\Client\Model\CreateList | Values to create a list try { - $result = $api_instance->createList($createList); + $result = $apiInstance->createList($createList); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->createList: ', $e->getMessage(), PHP_EOL; @@ -288,16 +313,21 @@ Deletes an attribute require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $attributeCategory = "attributeCategory_example"; // string | Category of the attribute $attributeName = "attributeName_example"; // string | Name of the existing attribute try { - $api_instance->deleteAttribute($attributeCategory, $attributeName); + $apiInstance->deleteAttribute($attributeCategory, $attributeName); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteAttribute: ', $e->getMessage(), PHP_EOL; } @@ -337,15 +367,20 @@ Deletes a contact require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $email = "email_example"; // string | Email (urlencoded) of the contact try { - $api_instance->deleteContact($email); + $apiInstance->deleteContact($email); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteContact: ', $e->getMessage(), PHP_EOL; } @@ -384,15 +419,20 @@ Delete a folder (and all its lists) require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | Id of the folder try { - $api_instance->deleteFolder($folderId); + $apiInstance->deleteFolder($folderId); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteFolder: ', $e->getMessage(), PHP_EOL; } @@ -431,15 +471,20 @@ Delete a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list try { - $api_instance->deleteList($listId); + $apiInstance->deleteList($listId); } catch (Exception $e) { echo 'Exception when calling ContactsApi->deleteList: ', $e->getMessage(), PHP_EOL; } @@ -478,14 +523,19 @@ Lists all attributes require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); try { - $result = $api_instance->getAttributes(); + $result = $apiInstance->getAttributes(); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getAttributes: ', $e->getMessage(), PHP_EOL; @@ -522,15 +572,20 @@ Retrieves contact informations require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $email = "email_example"; // string | Email (urlencoded) of the contact try { - $result = $api_instance->getContactInfo($email); + $result = $apiInstance->getContactInfo($email); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContactInfo: ', $e->getMessage(), PHP_EOL; @@ -570,15 +625,20 @@ Get the campaigns statistics for a contact require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $email = "email_example"; // string | Email address (urlencoded) of the contact try { - $result = $api_instance->getContactStats($email); + $result = $apiInstance->getContactStats($email); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContactStats: ', $e->getMessage(), PHP_EOL; @@ -618,17 +678,22 @@ Get all the contacts require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page $modifiedSince = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. try { - $result = $api_instance->getContacts($limit, $offset, $modifiedSince); + $result = $apiInstance->getContacts($limit, $offset, $modifiedSince); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContacts: ', $e->getMessage(), PHP_EOL; @@ -670,18 +735,23 @@ Get the contacts in a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list $modifiedSince = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getContactsFromList($listId, $modifiedSince, $limit, $offset); + $result = $apiInstance->getContactsFromList($listId, $modifiedSince, $limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContactsFromList: ', $e->getMessage(), PHP_EOL; @@ -724,15 +794,20 @@ Returns folder details require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | id of the folder try { - $result = $api_instance->getFolder($folderId); + $result = $apiInstance->getFolder($folderId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getFolder: ', $e->getMessage(), PHP_EOL; @@ -772,17 +847,22 @@ Get the lists in a folder require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | Id of the folder $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getFolderLists($folderId, $limit, $offset); + $result = $apiInstance->getFolderLists($folderId, $limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getFolderLists: ', $e->getMessage(), PHP_EOL; @@ -824,16 +904,21 @@ Get all the folders require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getFolders($limit, $offset); + $result = $apiInstance->getFolders($limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getFolders: ', $e->getMessage(), PHP_EOL; @@ -874,15 +959,20 @@ Get the details of a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list try { - $result = $api_instance->getList($listId); + $result = $apiInstance->getList($listId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getList: ', $e->getMessage(), PHP_EOL; @@ -922,16 +1012,21 @@ Get all the lists require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getLists($limit, $offset); + $result = $apiInstance->getLists($limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getLists: ', $e->getMessage(), PHP_EOL; @@ -974,15 +1069,20 @@ It returns the background process ID which on completion calls the notify URL th require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $requestContactImport = new \SendinBlue\Client\Model\RequestContactImport(); // \SendinBlue\Client\Model\RequestContactImport | Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` try { - $result = $api_instance->importContacts($requestContactImport); + $result = $apiInstance->importContacts($requestContactImport); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->importContacts: ', $e->getMessage(), PHP_EOL; @@ -1022,16 +1122,21 @@ Remove existing contacts from a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list $contactEmails = new \SendinBlue\Client\Model\RemoveContactFromList(); // \SendinBlue\Client\Model\RemoveContactFromList | Emails adresses of the contact try { - $result = $api_instance->removeContactFromList($listId, $contactEmails); + $result = $apiInstance->removeContactFromList($listId, $contactEmails); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->removeContactFromList: ', $e->getMessage(), PHP_EOL; @@ -1074,15 +1179,20 @@ It returns the background process ID which on completion calls the notify URL th require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $requestContactExport = new \SendinBlue\Client\Model\RequestContactExport(); // \SendinBlue\Client\Model\RequestContactExport | Values to request a contact export try { - $result = $api_instance->requestContactExport($requestContactExport); + $result = $apiInstance->requestContactExport($requestContactExport); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->requestContactExport: ', $e->getMessage(), PHP_EOL; @@ -1122,17 +1232,22 @@ Updates contact attribute require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $attributeCategory = "attributeCategory_example"; // string | Category of the attribute $attributeName = "attributeName_example"; // string | Name of the existing attribute $updateAttribute = new \SendinBlue\Client\Model\UpdateAttribute(); // \SendinBlue\Client\Model\UpdateAttribute | Values to update an attribute try { - $api_instance->updateAttribute($attributeCategory, $attributeName, $updateAttribute); + $apiInstance->updateAttribute($attributeCategory, $attributeName, $updateAttribute); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateAttribute: ', $e->getMessage(), PHP_EOL; } @@ -1173,16 +1288,21 @@ Updates a contact require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $email = "email_example"; // string | Email (urlencoded) of the contact $updateContact = new \SendinBlue\Client\Model\UpdateContact(); // \SendinBlue\Client\Model\UpdateContact | Values to update a contact try { - $api_instance->updateContact($email, $updateContact); + $apiInstance->updateContact($email, $updateContact); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateContact: ', $e->getMessage(), PHP_EOL; } @@ -1222,16 +1342,21 @@ Update a contact folder require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | Id of the folder $updateFolder = new \SendinBlue\Client\Model\CreateUpdateFolder(); // \SendinBlue\Client\Model\CreateUpdateFolder | Name of the folder try { - $api_instance->updateFolder($folderId, $updateFolder); + $apiInstance->updateFolder($folderId, $updateFolder); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateFolder: ', $e->getMessage(), PHP_EOL; } @@ -1271,16 +1396,21 @@ Update a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ContactsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list $updateList = new \SendinBlue\Client\Model\UpdateList(); // \SendinBlue\Client\Model\UpdateList | Values to update a list try { - $api_instance->updateList($listId, $updateList); + $apiInstance->updateList($listId, $updateList); } catch (Exception $e) { echo 'Exception when calling ContactsApi->updateList: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/EmailCampaignsApi.md b/docs/Api/EmailCampaignsApi.md index 05d10645..eddf22ee 100644 --- a/docs/Api/EmailCampaignsApi.md +++ b/docs/Api/EmailCampaignsApi.md @@ -27,15 +27,20 @@ Create an email campaign require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $emailCampaigns = new \SendinBlue\Client\Model\CreateEmailCampaign(); // \SendinBlue\Client\Model\CreateEmailCampaign | Values to create a campaign try { - $result = $api_instance->createEmailCampaign($emailCampaigns); + $result = $apiInstance->createEmailCampaign($emailCampaigns); print_r($result); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->createEmailCampaign: ', $e->getMessage(), PHP_EOL; @@ -75,15 +80,20 @@ Delete an email campaign require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | id of the campaign try { - $api_instance->deleteEmailCampaign($campaignId); + $apiInstance->deleteEmailCampaign($campaignId); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->deleteEmailCampaign: ', $e->getMessage(), PHP_EOL; } @@ -122,16 +132,21 @@ Export the recipients of a campaign require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | Id of the campaign $recipientExport = new \SendinBlue\Client\Model\EmailExportRecipients(); // \SendinBlue\Client\Model\EmailExportRecipients | Values to send for a recipient export request try { - $result = $api_instance->emailExportRecipients($campaignId, $recipientExport); + $result = $apiInstance->emailExportRecipients($campaignId, $recipientExport); print_r($result); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->emailExportRecipients: ', $e->getMessage(), PHP_EOL; @@ -172,15 +187,20 @@ Get campaign informations require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | Id of the campaign try { - $result = $api_instance->getEmailCampaign($campaignId); + $result = $apiInstance->getEmailCampaign($campaignId); print_r($result); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->getEmailCampaign: ', $e->getMessage(), PHP_EOL; @@ -220,18 +240,23 @@ Return all your created campaigns require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $type = "type_example"; // string | Filter on the type of the campaigns $status = "status_example"; // string | Filter on the status of the campaign $limit = 500; // int | Number of documents per page $offset = 0; // int | Index of the first document in the page try { - $result = $api_instance->getEmailCampaigns($type, $status, $limit, $offset); + $result = $apiInstance->getEmailCampaigns($type, $status, $limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->getEmailCampaigns: ', $e->getMessage(), PHP_EOL; @@ -274,15 +299,20 @@ Send an email campaign id of the campaign immediately require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | Id of the campaign try { - $api_instance->sendEmailCampaignNow($campaignId); + $apiInstance->sendEmailCampaignNow($campaignId); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->sendEmailCampaignNow: ', $e->getMessage(), PHP_EOL; } @@ -323,16 +353,21 @@ A PDF will be sent to the specified email addresses require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | Id of the campaign $sendReport = new \SendinBlue\Client\Model\SendReport(); // \SendinBlue\Client\Model\SendReport | Values for send a report try { - $api_instance->sendReport($campaignId, $sendReport); + $apiInstance->sendReport($campaignId, $sendReport); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->sendReport: ', $e->getMessage(), PHP_EOL; } @@ -372,16 +407,21 @@ Send an email campaign to your test list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | Id of the campaign $emailTo = new \SendinBlue\Client\Model\SendTestEmail(); // \SendinBlue\Client\Model\SendTestEmail | try { - $api_instance->sendTestEmail($campaignId, $emailTo); + $apiInstance->sendTestEmail($campaignId, $emailTo); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->sendTestEmail: ', $e->getMessage(), PHP_EOL; } @@ -421,16 +461,21 @@ Update a campaign status require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | Id of the campaign $status = new \SendinBlue\Client\Model\UpdateCampaignStatus(); // \SendinBlue\Client\Model\UpdateCampaignStatus | Status of the campaign try { - $api_instance->updateCampaignStatus($campaignId, $status); + $apiInstance->updateCampaignStatus($campaignId, $status); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->updateCampaignStatus: ', $e->getMessage(), PHP_EOL; } @@ -470,16 +515,21 @@ Update a campaign require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\EmailCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\EmailCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | Id of the campaign $emailCampaign = new \SendinBlue\Client\Model\UpdateEmailCampaign(); // \SendinBlue\Client\Model\UpdateEmailCampaign | Values to update a campaign try { - $api_instance->updateEmailCampaign($campaignId, $emailCampaign); + $apiInstance->updateEmailCampaign($campaignId, $emailCampaign); } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->updateEmailCampaign: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/FoldersApi.md b/docs/Api/FoldersApi.md index 27d40c22..f739d51d 100644 --- a/docs/Api/FoldersApi.md +++ b/docs/Api/FoldersApi.md @@ -23,15 +23,20 @@ Create a folder require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\FoldersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\FoldersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $createFolder = new \SendinBlue\Client\Model\CreateUpdateFolder(); // \SendinBlue\Client\Model\CreateUpdateFolder | Name of the folder try { - $result = $api_instance->createFolder($createFolder); + $result = $apiInstance->createFolder($createFolder); print_r($result); } catch (Exception $e) { echo 'Exception when calling FoldersApi->createFolder: ', $e->getMessage(), PHP_EOL; @@ -71,15 +76,20 @@ Delete a folder (and all its lists) require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\FoldersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\FoldersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | Id of the folder try { - $api_instance->deleteFolder($folderId); + $apiInstance->deleteFolder($folderId); } catch (Exception $e) { echo 'Exception when calling FoldersApi->deleteFolder: ', $e->getMessage(), PHP_EOL; } @@ -118,15 +128,20 @@ Returns folder details require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\FoldersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\FoldersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | id of the folder try { - $result = $api_instance->getFolder($folderId); + $result = $apiInstance->getFolder($folderId); print_r($result); } catch (Exception $e) { echo 'Exception when calling FoldersApi->getFolder: ', $e->getMessage(), PHP_EOL; @@ -166,17 +181,22 @@ Get the lists in a folder require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\FoldersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\FoldersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | Id of the folder $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getFolderLists($folderId, $limit, $offset); + $result = $apiInstance->getFolderLists($folderId, $limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling FoldersApi->getFolderLists: ', $e->getMessage(), PHP_EOL; @@ -218,16 +238,21 @@ Get all the folders require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\FoldersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\FoldersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getFolders($limit, $offset); + $result = $apiInstance->getFolders($limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling FoldersApi->getFolders: ', $e->getMessage(), PHP_EOL; @@ -268,16 +293,21 @@ Update a contact folder require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\FoldersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\FoldersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | Id of the folder $updateFolder = new \SendinBlue\Client\Model\CreateUpdateFolder(); // \SendinBlue\Client\Model\CreateUpdateFolder | Name of the folder try { - $api_instance->updateFolder($folderId, $updateFolder); + $apiInstance->updateFolder($folderId, $updateFolder); } catch (Exception $e) { echo 'Exception when calling FoldersApi->updateFolder: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/ListsApi.md b/docs/Api/ListsApi.md index 32ff7c2c..3c5457d9 100644 --- a/docs/Api/ListsApi.md +++ b/docs/Api/ListsApi.md @@ -26,16 +26,21 @@ Add existing contacts to a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list $contactEmails = new \SendinBlue\Client\Model\AddContactToList(); // \SendinBlue\Client\Model\AddContactToList | Emails addresses of the contacts try { - $result = $api_instance->addContactToList($listId, $contactEmails); + $result = $apiInstance->addContactToList($listId, $contactEmails); print_r($result); } catch (Exception $e) { echo 'Exception when calling ListsApi->addContactToList: ', $e->getMessage(), PHP_EOL; @@ -76,15 +81,20 @@ Create a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $createList = new \SendinBlue\Client\Model\CreateList(); // \SendinBlue\Client\Model\CreateList | Values to create a list try { - $result = $api_instance->createList($createList); + $result = $apiInstance->createList($createList); print_r($result); } catch (Exception $e) { echo 'Exception when calling ListsApi->createList: ', $e->getMessage(), PHP_EOL; @@ -124,15 +134,20 @@ Delete a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list try { - $api_instance->deleteList($listId); + $apiInstance->deleteList($listId); } catch (Exception $e) { echo 'Exception when calling ListsApi->deleteList: ', $e->getMessage(), PHP_EOL; } @@ -171,18 +186,23 @@ Get the contacts in a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list $modifiedSince = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getContactsFromList($listId, $modifiedSince, $limit, $offset); + $result = $apiInstance->getContactsFromList($listId, $modifiedSince, $limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling ListsApi->getContactsFromList: ', $e->getMessage(), PHP_EOL; @@ -225,17 +245,22 @@ Get the lists in a folder require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $folderId = 789; // int | Id of the folder $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getFolderLists($folderId, $limit, $offset); + $result = $apiInstance->getFolderLists($folderId, $limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling ListsApi->getFolderLists: ', $e->getMessage(), PHP_EOL; @@ -277,15 +302,20 @@ Get the details of a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list try { - $result = $api_instance->getList($listId); + $result = $apiInstance->getList($listId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ListsApi->getList: ', $e->getMessage(), PHP_EOL; @@ -325,16 +355,21 @@ Get all the lists require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page try { - $result = $api_instance->getLists($limit, $offset); + $result = $apiInstance->getLists($limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling ListsApi->getLists: ', $e->getMessage(), PHP_EOL; @@ -375,16 +410,21 @@ Remove existing contacts from a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list $contactEmails = new \SendinBlue\Client\Model\RemoveContactFromList(); // \SendinBlue\Client\Model\RemoveContactFromList | Emails adresses of the contact try { - $result = $api_instance->removeContactFromList($listId, $contactEmails); + $result = $apiInstance->removeContactFromList($listId, $contactEmails); print_r($result); } catch (Exception $e) { echo 'Exception when calling ListsApi->removeContactFromList: ', $e->getMessage(), PHP_EOL; @@ -425,16 +465,21 @@ Update a list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ListsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ListsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $listId = 789; // int | Id of the list $updateList = new \SendinBlue\Client\Model\UpdateList(); // \SendinBlue\Client\Model\UpdateList | Values to update a list try { - $api_instance->updateList($listId, $updateList); + $apiInstance->updateList($listId, $updateList); } catch (Exception $e) { echo 'Exception when calling ListsApi->updateList: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/ProcessApi.md b/docs/Api/ProcessApi.md index 196c13cd..60f1ace1 100644 --- a/docs/Api/ProcessApi.md +++ b/docs/Api/ProcessApi.md @@ -19,15 +19,20 @@ Return the informations for a process require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ProcessApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ProcessApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $processId = 789; // int | Id of the process try { - $result = $api_instance->getProcess($processId); + $result = $apiInstance->getProcess($processId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProcessApi->getProcess: ', $e->getMessage(), PHP_EOL; @@ -67,16 +72,21 @@ Return all the processes for your account require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ProcessApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ProcessApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 10; // int | Number limitation for the result returned $offset = 0; // int | Beginning point in the list to retrieve from. try { - $result = $api_instance->getProcesses($limit, $offset); + $result = $apiInstance->getProcesses($limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProcessApi->getProcesses: ', $e->getMessage(), PHP_EOL; diff --git a/docs/Api/ResellerApi.md b/docs/Api/ResellerApi.md index 2d8c077e..f56661e0 100644 --- a/docs/Api/ResellerApi.md +++ b/docs/Api/ResellerApi.md @@ -26,16 +26,21 @@ Add Email and/or SMS credits to a specific child account require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $childAuthKey = "childAuthKey_example"; // string | auth key of reseller's child $addCredits = new \SendinBlue\Client\Model\AddCredits(); // \SendinBlue\Client\Model\AddCredits | Values to post to add credit to a specific child account try { - $result = $api_instance->addCredits($childAuthKey, $addCredits); + $result = $apiInstance->addCredits($childAuthKey, $addCredits); print_r($result); } catch (Exception $e) { echo 'Exception when calling ResellerApi->addCredits: ', $e->getMessage(), PHP_EOL; @@ -76,16 +81,21 @@ Associate a dedicated IP to the child require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $childAuthKey = "childAuthKey_example"; // string | auth key of reseller's child $ip = new \SendinBlue\Client\Model\ManageIp(); // \SendinBlue\Client\Model\ManageIp | IP to associate try { - $api_instance->associateIpToChild($childAuthKey, $ip); + $apiInstance->associateIpToChild($childAuthKey, $ip); } catch (Exception $e) { echo 'Exception when calling ResellerApi->associateIpToChild: ', $e->getMessage(), PHP_EOL; } @@ -125,15 +135,20 @@ Creates a reseller child require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $resellerChild = new \SendinBlue\Client\Model\CreateChild(); // \SendinBlue\Client\Model\CreateChild | reseller child to add try { - $result = $api_instance->createResellerChild($resellerChild); + $result = $apiInstance->createResellerChild($resellerChild); print_r($result); } catch (Exception $e) { echo 'Exception when calling ResellerApi->createResellerChild: ', $e->getMessage(), PHP_EOL; @@ -173,15 +188,20 @@ Deletes a single reseller child based on the childAuthKey supplied require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $childAuthKey = "childAuthKey_example"; // string | auth key of reseller's child try { - $api_instance->deleteResellerChild($childAuthKey); + $apiInstance->deleteResellerChild($childAuthKey); } catch (Exception $e) { echo 'Exception when calling ResellerApi->deleteResellerChild: ', $e->getMessage(), PHP_EOL; } @@ -220,16 +240,21 @@ Dissociate a dedicated IP to the child require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $childAuthKey = "childAuthKey_example"; // string | auth key of reseller's child $ip = new \SendinBlue\Client\Model\ManageIp(); // \SendinBlue\Client\Model\ManageIp | IP to dissociate try { - $api_instance->dissociateIpFromChild($childAuthKey, $ip); + $apiInstance->dissociateIpFromChild($childAuthKey, $ip); } catch (Exception $e) { echo 'Exception when calling ResellerApi->dissociateIpFromChild: ', $e->getMessage(), PHP_EOL; } @@ -269,15 +294,20 @@ Gets the info about a specific child account require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $childAuthKey = "childAuthKey_example"; // string | auth key of reseller's child try { - $result = $api_instance->getChildInfo($childAuthKey); + $result = $apiInstance->getChildInfo($childAuthKey); print_r($result); } catch (Exception $e) { echo 'Exception when calling ResellerApi->getChildInfo: ', $e->getMessage(), PHP_EOL; @@ -317,14 +347,19 @@ Gets the list of all reseller's children accounts require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); try { - $result = $api_instance->getResellerChilds(); + $result = $apiInstance->getResellerChilds(); print_r($result); } catch (Exception $e) { echo 'Exception when calling ResellerApi->getResellerChilds: ', $e->getMessage(), PHP_EOL; @@ -361,16 +396,21 @@ Remove Email and/or SMS credits from a specific child account require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $childAuthKey = "childAuthKey_example"; // string | auth key of reseller's child $removeCredits = new \SendinBlue\Client\Model\RemoveCredits(); // \SendinBlue\Client\Model\RemoveCredits | Values to post to remove email or SMS credits from a specific child account try { - $result = $api_instance->removeCredits($childAuthKey, $removeCredits); + $result = $apiInstance->removeCredits($childAuthKey, $removeCredits); print_r($result); } catch (Exception $e) { echo 'Exception when calling ResellerApi->removeCredits: ', $e->getMessage(), PHP_EOL; @@ -411,16 +451,21 @@ Updates infos of reseller's child based on the childAuthKey supplied require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\ResellerApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\ResellerApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $childAuthKey = "childAuthKey_example"; // string | auth key of reseller's child $resellerChild = new \SendinBlue\Client\Model\UpdateChild(); // \SendinBlue\Client\Model\UpdateChild | values to update in child profile try { - $api_instance->updateResellerChild($childAuthKey, $resellerChild); + $apiInstance->updateResellerChild($childAuthKey, $resellerChild); } catch (Exception $e) { echo 'Exception when calling ResellerApi->updateResellerChild: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/SMSCampaignsApi.md b/docs/Api/SMSCampaignsApi.md index 585aa9b0..c6d7c316 100644 --- a/docs/Api/SMSCampaignsApi.md +++ b/docs/Api/SMSCampaignsApi.md @@ -27,15 +27,20 @@ Creates an SMS campaign require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $createSmsCampaign = new \SendinBlue\Client\Model\CreateSmsCampaign(); // \SendinBlue\Client\Model\CreateSmsCampaign | Values to create an SMS Campaign try { - $result = $api_instance->createSmsCampaign($createSmsCampaign); + $result = $apiInstance->createSmsCampaign($createSmsCampaign); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->createSmsCampaign: ', $e->getMessage(), PHP_EOL; @@ -75,15 +80,20 @@ Delete the SMS campaign require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | id of the SMS campaign try { - $api_instance->deleteSmsCampaign($campaignId); + $apiInstance->deleteSmsCampaign($campaignId); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->deleteSmsCampaign: ', $e->getMessage(), PHP_EOL; } @@ -122,16 +132,21 @@ Get an SMS campaign require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | id of the SMS campaign $getSmsCampaign = new \SendinBlue\Client\Model\GetSmsCampaign(); // \SendinBlue\Client\Model\GetSmsCampaign | Values to update an SMS Campaign try { - $result = $api_instance->getSmsCampaign($campaignId, $getSmsCampaign); + $result = $apiInstance->getSmsCampaign($campaignId, $getSmsCampaign); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->getSmsCampaign: ', $e->getMessage(), PHP_EOL; @@ -172,17 +187,22 @@ Returns the informations for all your created SMS campaigns require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $status = "status_example"; // string | Status of campaign. $limit = 500; // int | Number limitation for the result returned $offset = 0; // int | Beginning point in the list to retrieve from. try { - $result = $api_instance->getSmsCampaigns($status, $limit, $offset); + $result = $apiInstance->getSmsCampaigns($status, $limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->getSmsCampaigns: ', $e->getMessage(), PHP_EOL; @@ -226,16 +246,21 @@ It returns the background process ID which on completion calls the notify URL th require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | id of the campaign $recipientExport = new \SendinBlue\Client\Model\RequestSmsRecipientExport(); // \SendinBlue\Client\Model\RequestSmsRecipientExport | Values to send for a recipient export request try { - $result = $api_instance->requestSmsRecipientExport($campaignId, $recipientExport); + $result = $apiInstance->requestSmsRecipientExport($campaignId, $recipientExport); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->requestSmsRecipientExport: ', $e->getMessage(), PHP_EOL; @@ -276,15 +301,20 @@ Send your SMS campaign immediately require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | id of the campaign try { - $api_instance->sendSmsCampaignNow($campaignId); + $apiInstance->sendSmsCampaignNow($campaignId); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->sendSmsCampaignNow: ', $e->getMessage(), PHP_EOL; } @@ -325,16 +355,21 @@ Send report of Sent and Archived campaign, to the specified email addresses, wit require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | id of the campaign $sendReport = new \SendinBlue\Client\Model\SendReport(); // \SendinBlue\Client\Model\SendReport | Values for send a report try { - $api_instance->sendSmsReport($campaignId, $sendReport); + $apiInstance->sendSmsReport($campaignId, $sendReport); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->sendSmsReport: ', $e->getMessage(), PHP_EOL; } @@ -374,16 +409,21 @@ Send an SMS require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | Id of the SMS campaign $sendTestSms = new \SendinBlue\Client\Model\SendTestSms(); // \SendinBlue\Client\Model\SendTestSms | Mobile number to which send the test try { - $api_instance->sendTestSms($campaignId, $sendTestSms); + $apiInstance->sendTestSms($campaignId, $sendTestSms); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->sendTestSms: ', $e->getMessage(), PHP_EOL; } @@ -423,16 +463,21 @@ Updates an SMS campaign require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | id of the SMS campaign $updateSmsCampaign = new \SendinBlue\Client\Model\UpdateSmsCampaign(); // \SendinBlue\Client\Model\UpdateSmsCampaign | Values to update an SMS Campaign try { - $api_instance->updateSmsCampaign($campaignId, $updateSmsCampaign); + $apiInstance->updateSmsCampaign($campaignId, $updateSmsCampaign); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->updateSmsCampaign: ', $e->getMessage(), PHP_EOL; } @@ -472,16 +517,21 @@ Update the campaign status require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMSCampaignsApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $campaignId = 789; // int | id of the campaign $status = new \SendinBlue\Client\Model\UpdateCampaignStatus(); // \SendinBlue\Client\Model\UpdateCampaignStatus | Status of the campaign. try { - $api_instance->updateSmsCampaignStatus($campaignId, $status); + $apiInstance->updateSmsCampaignStatus($campaignId, $status); } catch (Exception $e) { echo 'Exception when calling SMSCampaignsApi->updateSmsCampaignStatus: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/SMTPApi.md b/docs/Api/SMTPApi.md index dca2679e..04e02091 100644 --- a/docs/Api/SMTPApi.md +++ b/docs/Api/SMTPApi.md @@ -29,15 +29,20 @@ Create an smtp template require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $smtpTemplate = new \SendinBlue\Client\Model\CreateSmtpTemplate(); // \SendinBlue\Client\Model\CreateSmtpTemplate | values to update in smtp template try { - $result = $api_instance->createSmtpTemplate($smtpTemplate); + $result = $apiInstance->createSmtpTemplate($smtpTemplate); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMTPApi->createSmtpTemplate: ', $e->getMessage(), PHP_EOL; @@ -79,15 +84,20 @@ Delete hardbounces. To use carefully (e.g. in case of temporary ISP failures) require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $deleteHardbounces = new \SendinBlue\Client\Model\DeleteHardbounces(); // \SendinBlue\Client\Model\DeleteHardbounces | values to delete hardbounces try { - $api_instance->deleteHardbounces($deleteHardbounces); + $apiInstance->deleteHardbounces($deleteHardbounces); } catch (Exception $e) { echo 'Exception when calling SMTPApi->deleteHardbounces: ', $e->getMessage(), PHP_EOL; } @@ -126,15 +136,20 @@ Delete an inactive smtp template require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $templateId = 789; // int | id of the template try { - $api_instance->deleteSmtpTemplate($templateId); + $apiInstance->deleteSmtpTemplate($templateId); } catch (Exception $e) { echo 'Exception when calling SMTPApi->deleteSmtpTemplate: ', $e->getMessage(), PHP_EOL; } @@ -173,18 +188,23 @@ Get your SMTP activity aggregated over a period of time require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate $endDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate $days = 56; // int | Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' $tag = "tag_example"; // string | Tag of the emails try { - $result = $api_instance->getAggregatedSmtpReport($startDate, $endDate, $days, $tag); + $result = $apiInstance->getAggregatedSmtpReport($startDate, $endDate, $days, $tag); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMTPApi->getAggregatedSmtpReport: ', $e->getMessage(), PHP_EOL; @@ -227,11 +247,16 @@ Get all your SMTP activity (unaggregated events) require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 50; // int | Number limitation for the result returned $offset = 0; // int | Beginning point in the list to retrieve from. $startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate @@ -244,7 +269,7 @@ $messageId = "messageId_example"; // string | Filter on a specific message id $templateId = 789; // int | Filter on a specific template id try { - $result = $api_instance->getEmailEventReport($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId); + $result = $apiInstance->getEmailEventReport($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMTPApi->getEmailEventReport: ', $e->getMessage(), PHP_EOL; @@ -293,11 +318,16 @@ Get your SMTP activity aggregated per day require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 50; // int | Number of documents returned per page $offset = 0; // int | Index of the first document on the page $startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) @@ -306,7 +336,7 @@ $days = 56; // int | Number of days in the past including today (positive intege $tag = "tag_example"; // string | Tag of the emails try { - $result = $api_instance->getSmtpReport($limit, $offset, $startDate, $endDate, $days, $tag); + $result = $apiInstance->getSmtpReport($limit, $offset, $startDate, $endDate, $days, $tag); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMTPApi->getSmtpReport: ', $e->getMessage(), PHP_EOL; @@ -351,15 +381,20 @@ Returns the template informations require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $templateId = 789; // int | id of the template try { - $result = $api_instance->getSmtpTemplate($templateId); + $result = $apiInstance->getSmtpTemplate($templateId); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMTPApi->getSmtpTemplate: ', $e->getMessage(), PHP_EOL; @@ -399,17 +434,22 @@ Get the list of SMTP templates require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $templateStatus = true; // bool | Filter on the status of the template. Active = true, inactive = false $limit = 50; // int | Number of documents returned per page $offset = 0; // int | Index of the first document in the page try { - $result = $api_instance->getSmtpTemplates($templateStatus, $limit, $offset); + $result = $apiInstance->getSmtpTemplates($templateStatus, $limit, $offset); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMTPApi->getSmtpTemplates: ', $e->getMessage(), PHP_EOL; @@ -445,22 +485,29 @@ Name | Type | Description | Notes Send a template +This endpoint is deprecated. Prefer v3/smtp/email instead. + ### Example ```php setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $templateId = 789; // int | Id of the template $sendEmail = new \SendinBlue\Client\Model\SendEmail(); // \SendinBlue\Client\Model\SendEmail | try { - $result = $api_instance->sendTemplate($templateId, $sendEmail); + $result = $apiInstance->sendTemplate($templateId, $sendEmail); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMTPApi->sendTemplate: ', $e->getMessage(), PHP_EOL; @@ -501,16 +548,21 @@ Send a template to your test list require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $templateId = 789; // int | Id of the template $sendTestEmail = new \SendinBlue\Client\Model\SendTestEmail(); // \SendinBlue\Client\Model\SendTestEmail | try { - $api_instance->sendTestTemplate($templateId, $sendTestEmail); + $apiInstance->sendTestTemplate($templateId, $sendTestEmail); } catch (Exception $e) { echo 'Exception when calling SMTPApi->sendTestTemplate: ', $e->getMessage(), PHP_EOL; } @@ -550,15 +602,20 @@ Send a transactional email require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $sendSmtpEmail = new \SendinBlue\Client\Model\SendSmtpEmail(); // \SendinBlue\Client\Model\SendSmtpEmail | Values to send a transactional email try { - $result = $api_instance->sendTransacEmail($sendSmtpEmail); + $result = $apiInstance->sendTransacEmail($sendSmtpEmail); print_r($result); } catch (Exception $e) { echo 'Exception when calling SMTPApi->sendTransacEmail: ', $e->getMessage(), PHP_EOL; @@ -598,16 +655,21 @@ Updates an smtp templates require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SMTPApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SMTPApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $templateId = 789; // int | id of the template $smtpTemplate = new \SendinBlue\Client\Model\UpdateSmtpTemplate(); // \SendinBlue\Client\Model\UpdateSmtpTemplate | values to update in smtp template try { - $api_instance->updateSmtpTemplate($templateId, $smtpTemplate); + $apiInstance->updateSmtpTemplate($templateId, $smtpTemplate); } catch (Exception $e) { echo 'Exception when calling SMTPApi->updateSmtpTemplate: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/SendersApi.md b/docs/Api/SendersApi.md index 0ae40011..328b6288 100644 --- a/docs/Api/SendersApi.md +++ b/docs/Api/SendersApi.md @@ -23,15 +23,20 @@ Create a new sender require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SendersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SendersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $sender = new \SendinBlue\Client\Model\CreateSender(); // \SendinBlue\Client\Model\CreateSender | sender's name try { - $result = $api_instance->createSender($sender); + $result = $apiInstance->createSender($sender); print_r($result); } catch (Exception $e) { echo 'Exception when calling SendersApi->createSender: ', $e->getMessage(), PHP_EOL; @@ -71,15 +76,20 @@ Delete a sender require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SendersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SendersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $senderId = 789; // int | Id of the sender try { - $api_instance->deleteSender($senderId); + $apiInstance->deleteSender($senderId); } catch (Exception $e) { echo 'Exception when calling SendersApi->deleteSender: ', $e->getMessage(), PHP_EOL; } @@ -118,14 +128,19 @@ Return all the dedicated IPs for your account require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); -$api_instance = new SendinBlue\Client\Api\SendersApi(); +$apiInstance = new SendinBlue\Client\Api\SendersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); try { - $result = $api_instance->getIps(); + $result = $apiInstance->getIps(); print_r($result); } catch (Exception $e) { echo 'Exception when calling SendersApi->getIps: ', $e->getMessage(), PHP_EOL; @@ -162,15 +177,20 @@ Return all the dedicated IPs for a sender require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SendersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SendersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $senderId = 789; // int | Id of the sender try { - $result = $api_instance->getIpsFromSender($senderId); + $result = $apiInstance->getIpsFromSender($senderId); print_r($result); } catch (Exception $e) { echo 'Exception when calling SendersApi->getIpsFromSender: ', $e->getMessage(), PHP_EOL; @@ -210,16 +230,21 @@ Get the list of all your senders require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SendersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SendersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $ip = "ip_example"; // string | Filter your senders for a specific ip (available for dedicated IP usage only) $domain = "domain_example"; // string | Filter your senders for a specific domain try { - $result = $api_instance->getSenders($ip, $domain); + $result = $apiInstance->getSenders($ip, $domain); print_r($result); } catch (Exception $e) { echo 'Exception when calling SendersApi->getSenders: ', $e->getMessage(), PHP_EOL; @@ -260,16 +285,21 @@ Update a sender require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\SendersApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\SendersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $senderId = 789; // int | Id of the sender $sender = new \SendinBlue\Client\Model\UpdateSender(); // \SendinBlue\Client\Model\UpdateSender | sender's name try { - $api_instance->updateSender($senderId, $sender); + $apiInstance->updateSender($senderId, $sender); } catch (Exception $e) { echo 'Exception when calling SendersApi->updateSender: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Api/TransactionalSMSApi.md b/docs/Api/TransactionalSMSApi.md index d87b153d..92cafbf2 100644 --- a/docs/Api/TransactionalSMSApi.md +++ b/docs/Api/TransactionalSMSApi.md @@ -21,11 +21,16 @@ Get all the SMS activity (unaggregated events) require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\TransactionalSMSApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\TransactionalSMSApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $limit = 50; // int | Number of documents per page $startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report $endDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report @@ -36,7 +41,7 @@ $event = "event_example"; // string | Filter the report for specific events $tags = "tags_example"; // string | Filter the report for specific tags passed as a serialized urlencoded array try { - $result = $api_instance->getSmsEvents($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags); + $result = $apiInstance->getSmsEvents($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags); print_r($result); } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->getSmsEvents: ', $e->getMessage(), PHP_EOL; @@ -83,18 +88,23 @@ Get your SMS activity aggregated over a period of time require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\TransactionalSMSApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\TransactionalSMSApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report $endDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report $days = 56; // int | Number of days in the past including today (positive integer). Not compatible with startDate and endDate $tag = "tag_example"; // string | Filter on a tag try { - $result = $api_instance->getTransacAggregatedSmsReport($startDate, $endDate, $days, $tag); + $result = $apiInstance->getTransacAggregatedSmsReport($startDate, $endDate, $days, $tag); print_r($result); } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->getTransacAggregatedSmsReport: ', $e->getMessage(), PHP_EOL; @@ -137,18 +147,23 @@ Get your SMS activity aggregated per day require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\TransactionalSMSApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\TransactionalSMSApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report $endDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report $days = 56; // int | Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' $tag = "tag_example"; // string | Filter on a tag try { - $result = $api_instance->getTransacSmsReport($startDate, $endDate, $days, $tag); + $result = $apiInstance->getTransacSmsReport($startDate, $endDate, $days, $tag); print_r($result); } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->getTransacSmsReport: ', $e->getMessage(), PHP_EOL; @@ -191,15 +206,20 @@ Send the SMS campaign to the specified mobile number require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\TransactionalSMSApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\TransactionalSMSApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $sendTransacSms = new \SendinBlue\Client\Model\SendTransacSms(); // \SendinBlue\Client\Model\SendTransacSms | Values to send a transactional SMS try { - $result = $api_instance->sendTransacSms($sendTransacSms); + $result = $apiInstance->sendTransacSms($sendTransacSms); print_r($result); } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->sendTransacSms: ', $e->getMessage(), PHP_EOL; diff --git a/docs/Api/WebhooksApi.md b/docs/Api/WebhooksApi.md index 4ac9b31e..f77354d5 100644 --- a/docs/Api/WebhooksApi.md +++ b/docs/Api/WebhooksApi.md @@ -22,15 +22,20 @@ Create a webhook require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\WebhooksApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\WebhooksApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $createWebhook = new \SendinBlue\Client\Model\CreateWebhook(); // \SendinBlue\Client\Model\CreateWebhook | Values to create a webhook try { - $result = $api_instance->createWebhook($createWebhook); + $result = $apiInstance->createWebhook($createWebhook); print_r($result); } catch (Exception $e) { echo 'Exception when calling WebhooksApi->createWebhook: ', $e->getMessage(), PHP_EOL; @@ -70,15 +75,20 @@ Delete a webhook require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\WebhooksApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\WebhooksApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $webhookId = 789; // int | Id of the webhook try { - $api_instance->deleteWebhook($webhookId); + $apiInstance->deleteWebhook($webhookId); } catch (Exception $e) { echo 'Exception when calling WebhooksApi->deleteWebhook: ', $e->getMessage(), PHP_EOL; } @@ -117,15 +127,20 @@ Get a webhook details require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\WebhooksApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\WebhooksApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $webhookId = 789; // int | Id of the webhook try { - $result = $api_instance->getWebhook($webhookId); + $result = $apiInstance->getWebhook($webhookId); print_r($result); } catch (Exception $e) { echo 'Exception when calling WebhooksApi->getWebhook: ', $e->getMessage(), PHP_EOL; @@ -165,15 +180,20 @@ Get all webhooks require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\WebhooksApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\WebhooksApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $type = "transactional"; // string | Filter on webhook type try { - $result = $api_instance->getWebhooks($type); + $result = $apiInstance->getWebhooks($type); print_r($result); } catch (Exception $e) { echo 'Exception when calling WebhooksApi->getWebhooks: ', $e->getMessage(), PHP_EOL; @@ -213,16 +233,21 @@ Update a webhook require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api-key -SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); +$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); - -$api_instance = new SendinBlue\Client\Api\WebhooksApi(); +// $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); + +$apiInstance = new SendinBlue\Client\Api\WebhooksApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); $webhookId = 789; // int | Id of the webhook $updateWebhook = new \SendinBlue\Client\Model\UpdateWebhook(); // \SendinBlue\Client\Model\UpdateWebhook | Values to update a webhook try { - $api_instance->updateWebhook($webhookId, $updateWebhook); + $apiInstance->updateWebhook($webhookId, $updateWebhook); } catch (Exception $e) { echo 'Exception when calling WebhooksApi->updateWebhook: ', $e->getMessage(), PHP_EOL; } diff --git a/docs/Model/AddCredits.md b/docs/Model/AddCredits.md index d9f9527d..81e36943 100644 --- a/docs/Model/AddCredits.md +++ b/docs/Model/AddCredits.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sms** | **int** | SMS credits to be added to the child account | [optional] -**email** | **int** | Email credits to be added to the child account | [optional] +**sms** | **int** | Required if email credits are empty. SMS credits to be added to the child account | [optional] +**email** | **int** | Required if sms credits are empty. Email credits to be added to the child account | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateAttribute.md b/docs/Model/CreateAttribute.md index 531dcf5d..2f5a0c5d 100644 --- a/docs/Model/CreateAttribute.md +++ b/docs/Model/CreateAttribute.md @@ -3,9 +3,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **string** | Value of the attribute. Use only if the attribute's category is calculated or global | [optional] -**enumeration** | [**\SendinBlue\Client\Model\CreateAttributeEnumeration[]**](CreateAttributeEnumeration.md) | Values that the attribute can take. Use only if the attribute's category is category | [optional] -**type** | **string** | Type of the attribute. Use only if the attribute's category is normal, category or transactional ( type 'id' only available if the category is 'transactional' attribute & type 'category' only available if the category is 'category' attribute ) | [optional] +**value** | **string** | Value of the attribute. Use only if the attribute's category is 'calculated' or 'global' | [optional] +**enumeration** | [**\SendinBlue\Client\Model\CreateAttributeEnumeration[]**](CreateAttributeEnumeration.md) | List of values and labels that the attribute can take. Use only if the attribute's category is \"category\". For example, [{'value':1, 'label':'male'}, {'value':2, 'label':'female'}] | [optional] +**type** | **string** | Type of the attribute. Use only if the attribute's category is 'normal', 'category' or 'transactional' ( type 'id' is only available if the category is 'transactional' attribute & type 'category' is only available if the category is 'category' attribute ) | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateContact.md b/docs/Model/CreateContact.md index 645e6029..4cf4bb18 100644 --- a/docs/Model/CreateContact.md +++ b/docs/Model/CreateContact.md @@ -3,12 +3,12 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**email** | **string** | Email address of the user. Mandatory if `attributes.sms` is not passed | [optional] -**attributes** | **object** | Values of the attributes to fill. The attributes must exist in you contact database | [optional] -**emailBlacklisted** | **bool** | Blacklist the contact for emails (emailBlacklisted = true) | [optional] -**smsBlacklisted** | **bool** | Blacklist the contact for SMS (smsBlacklisted = true) | [optional] +**email** | **string** | Email address of the user. Mandatory if \"sms\" field is not passed in \"attributes\" parameter' | [optional] +**attributes** | **object** | Pass the set of attributes and their values. These attributes must be present in your SendinBlue account. For eg. {'FNAME':'Elly', 'LNAME':'Roger'} | [optional] +**emailBlacklisted** | **bool** | Set this field to blacklist the contact for emails (emailBlacklisted = true) | [optional] +**smsBlacklisted** | **bool** | Set this field to blacklist the contact for SMS (smsBlacklisted = true) | [optional] **listIds** | **int[]** | Ids of the lists to add the contact to | [optional] -**updateEnabled** | **bool** | Facilitate to update existing contact in same request (updateEnabled = true) | [optional] [default to false] +**updateEnabled** | **bool** | Facilitate to update the existing contact in the same request (updateEnabled = true) | [optional] [default to false] **smtpBlacklistSender** | **string[]** | SMTP forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true ) | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateEmailCampaign.md b/docs/Model/CreateEmailCampaign.md index a0b9398c..222a6bb2 100644 --- a/docs/Model/CreateEmailCampaign.md +++ b/docs/Model/CreateEmailCampaign.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **tag** | **string** | Tag of the campaign | [optional] -**sender** | [**\SendinBlue\Client\Model\CreateEmailCampaignSender**](CreateEmailCampaignSender.md) | | [optional] +**sender** | [**\SendinBlue\Client\Model\CreateEmailCampaignSender**](CreateEmailCampaignSender.md) | | **name** | **string** | Name of the campaign | **htmlContent** | **string** | Mandatory if htmlUrl is empty. Body of the message (HTML) | [optional] **htmlUrl** | **string** | Mandatory if htmlContent is empty. Url to the message (HTML) | [optional] -**scheduledAt** | **\DateTime** | Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. | [optional] +**scheduledAt** | [**\DateTime**] | Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. | [optional] **subject** | **string** | Subject of the campaign | **replyTo** | **string** | Email on which the campaign recipients will be able to reply to | [optional] **toField** | **string** | To personalize the «To» Field, e.g. if you want to include the first name and last name of your recipient, use {FNAME} {LNAME}. These attributes must already exist in your contact database | [optional] diff --git a/docs/Model/CreateList.md b/docs/Model/CreateList.md index 79376dcf..78c83441 100644 --- a/docs/Model/CreateList.md +++ b/docs/Model/CreateList.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **string** | Name of the list | -**folderId** | **int** | Id of the folder in which to create the list | +**folderId** | **int** | Id of the parent folder in which this list is to be created | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSmsCampaign.md b/docs/Model/CreateSmsCampaign.md index 31f74188..d19a86f8 100644 --- a/docs/Model/CreateSmsCampaign.md +++ b/docs/Model/CreateSmsCampaign.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **sender** | **string** | Name of the sender. The number of characters is limited to 11 | **content** | **string** | Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS | [optional] **recipients** | [**\SendinBlue\Client\Model\CreateSmsCampaignRecipients**](CreateSmsCampaignRecipients.md) | | [optional] -**scheduledAt** | **\DateTime** | UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. | [optional] +**scheduledAt** | [**\DateTime**] | UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSmtpTemplate.md b/docs/Model/CreateSmtpTemplate.md index a016af89..f368b19c 100644 --- a/docs/Model/CreateSmtpTemplate.md +++ b/docs/Model/CreateSmtpTemplate.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **tag** | **string** | Tag of the template | [optional] -**sender** | [**\SendinBlue\Client\Model\CreateSmtpTemplateSender**](CreateSmtpTemplateSender.md) | | [optional] +**sender** | [**\SendinBlue\Client\Model\CreateSmtpTemplateSender**](CreateSmtpTemplateSender.md) | | **templateName** | **string** | Name of the template | **htmlContent** | **string** | Body of the message (HTML version). The field must have more than 10 characters. REQUIRED if htmlUrl is empty | [optional] **htmlUrl** | **string** | Url which contents the body of the email message. REQUIRED if htmlContent is empty | [optional] diff --git a/docs/Model/DeleteHardbounces.md b/docs/Model/DeleteHardbounces.md index ee1e5dad..af31c91f 100644 --- a/docs/Model/DeleteHardbounces.md +++ b/docs/Model/DeleteHardbounces.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**startDate** | **\DateTime** | Starting date (YYYY-MM-DD) of the period from which the hardbounces will be deleted. Must be lower than equal to endDate | [optional] -**endDate** | **\DateTime** | Ending date (YYYY-MM-DD) of the period from which the hardbounces will be deleted. Must be greater than equal to startDate | [optional] +**startDate** | [**\DateTime**] | Starting date (YYYY-MM-DD) of the time period for deletion. The hardbounces occurred after this date will be deleted. Must be less than or equal to the endDate | [optional] +**endDate** | [**\DateTime**] | Ending date (YYYY-MM-DD) of the time period for deletion. The hardbounces until this date will be deleted. Must be greater than or equal to the startDate | [optional] **contactEmail** | **string** | Target a specific email address | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccount.md b/docs/Model/GetAccount.md index a7a83de9..95ffdce3 100644 --- a/docs/Model/GetAccount.md +++ b/docs/Model/GetAccount.md @@ -7,9 +7,9 @@ Name | Type | Description | Notes **firstName** | **string** | First Name | **lastName** | **string** | Last Name | **companyName** | **string** | Name of the company | -**address** | [**\SendinBlue\Client\Model\GetExtendedClientAddress**](GetExtendedClientAddress.md) | | [optional] +**address** | [**\SendinBlue\Client\Model\GetExtendedClientAddress**](GetExtendedClientAddress.md) | | **plan** | [**\SendinBlue\Client\Model\GetAccountPlan[]**](GetAccountPlan.md) | Information about your plans and credits | -**relay** | [**\SendinBlue\Client\Model\GetAccountRelay**](GetAccountRelay.md) | | [optional] +**relay** | [**\SendinBlue\Client\Model\GetAccountRelay**](GetAccountRelay.md) | | **marketingAutomation** | [**\SendinBlue\Client\Model\GetAccountMarketingAutomation**](GetAccountMarketingAutomation.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountPlan.md b/docs/Model/GetAccountPlan.md index 463b0d1a..62530467 100644 --- a/docs/Model/GetAccountPlan.md +++ b/docs/Model/GetAccountPlan.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | **string** | Displays the plan type of the user | **creditsType** | **string** | This is the type of the credit, \"Send Limit\" is one of the possible types of credit of a user. \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. | -**credits** | **float** | Remaining credits of the user -**startDate** | **\DateTime** | Date of the period from which the plan will start (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) | [optional] -**endDate** | **\DateTime** | Date of the period from which the plan will end (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) | [optional] +**credits** | **float** | Remaining credits of the user | +**startDate** | [**\DateTime**] | Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type) | [optional] +**endDate** | [**\DateTime**] | Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type) | [optional] **userLimit** | **int** | Only in case of reseller account. It implies the total number of child accounts you can add to your account. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAccountRelay.md b/docs/Model/GetAccountRelay.md index 8015a197..570d10a3 100644 --- a/docs/Model/GetAccountRelay.md +++ b/docs/Model/GetAccountRelay.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enabled** | **bool** | Status of your SMTP Account (true=Enabled, false=Disabled) | -**data** | [**\SendinBlue\Client\Model\GetAccountRelayData**](GetAccountRelayData.md) | | [optional] +**data** | [**\SendinBlue\Client\Model\GetAccountRelayData**](GetAccountRelayData.md) | | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCampaignOverview.md b/docs/Model/GetCampaignOverview.md index 10e21283..8d2a868a 100644 --- a/docs/Model/GetCampaignOverview.md +++ b/docs/Model/GetCampaignOverview.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **subject** | **string** | Subject of the campaign | **type** | **string** | Type of campaign | **status** | **string** | Status of the campaign | -**scheduledAt** | **\DateTime** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] +**scheduledAt** | [**\DateTime**] | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetCampaignStats.md b/docs/Model/GetCampaignStats.md index 21aab5e0..9e6f88a9 100644 --- a/docs/Model/GetCampaignStats.md +++ b/docs/Model/GetCampaignStats.md @@ -3,9 +3,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**listId** | **int** | List Id of email campaign (only in case of get email campaign(s)) | [optional] +**listId** | **int** | List Id of email campaign (only in case of get email campaign(s)(not for global stats)) | [optional] **uniqueClicks** | **int** | Number of unique clicks for the campaign | -**clickers** | **int** | Number of clicks for the campaign | +**clickers** | **int** | Number of total clicks for the campaign | **complaints** | **int** | Number of complaints (Spam reports) for the campaign | **delivered** | **int** | Number of delivered emails for the campaign | **sent** | **int** | Number of sent emails for the campaign | @@ -14,7 +14,7 @@ Name | Type | Description | Notes **uniqueViews** | **int** | Number of unique openings for the campaign | **unsubscriptions** | **int** | Number of unsubscription for the campaign | **viewed** | **int** | Number of openings for the campaign | -**deferred** | **int** | Number of deferred emails for the campaign | +**deferred** | **int** | Number of deferred emails for the campaign | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetChildInfo.md b/docs/Model/GetChildInfo.md index cedfcf5d..cd1dfa18 100644 --- a/docs/Model/GetChildInfo.md +++ b/docs/Model/GetChildInfo.md @@ -10,8 +10,8 @@ Name | Type | Description | Notes **credits** | [**\SendinBlue\Client\Model\GetChildInfoCredits**](GetChildInfoCredits.md) | | [optional] **statistics** | [**\SendinBlue\Client\Model\GetChildInfoStatistics**](GetChildInfoStatistics.md) | | [optional] **password** | **string** | The encrypted password of child account | -**ips** | [**\SendinBlue\Client\Model\GetChildInfoIps[]**](GetChildInfoIps.md) | IP(s) associated to a child account user | [optional] -**apiKeys** | [**\SendinBlue\Client\Model\GetChildInfoApiKeys[]**](GetChildInfoApiKeys.md) | API Keys associated to child account | [optional] +**ips** | **string[]** | IP(s) associated to a child account user | [optional] +**apiKeys** | [**\SendinBlue\Client\Model\GetChildInfoApiKeys**](GetChildInfoApiKeys.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetChildInfoApiKeys.md b/docs/Model/GetChildInfoApiKeys.md index 3df1468a..532de404 100644 --- a/docs/Model/GetChildInfoApiKeys.md +++ b/docs/Model/GetChildInfoApiKeys.md @@ -3,9 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the key | -**key** | **string** | API Key | -**secret** | **string** | Secret Key associated to the API Key (in case v1 Key is used only) | [optional] +**v2** | [**\SendinBlue\Client\Model\GetChildInfoApiKeysV2[]**](GetChildInfoApiKeysV2.md) | | +**v3** | [**\SendinBlue\Client\Model\GetChildInfoApiKeysV3[]**](GetChildInfoApiKeysV3.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactCampaignStatsOpened.md b/docs/Model/GetContactCampaignStatsOpened.md index 3795f55a..6f8c8439 100644 --- a/docs/Model/GetContactCampaignStatsOpened.md +++ b/docs/Model/GetContactCampaignStatsOpened.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **campaignId** | **int** | ID of the campaign which generated the event | **count** | **int** | Number of openings of the campaign | -**eventTime** | **\DateTime** | UTC date-time of the event | +**eventTime** | [**\DateTime**] | UTC date-time of the event | **ip** | **string** | IP from which the user has opened the campaign | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetContactCampaignStatsTransacAttributes.md b/docs/Model/GetContactCampaignStatsTransacAttributes.md index 55405804..a23e7522 100644 --- a/docs/Model/GetContactCampaignStatsTransacAttributes.md +++ b/docs/Model/GetContactCampaignStatsTransacAttributes.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**orderDate** | **\DateTime** | Date of the order | +**orderDate** | [**\DateTime**] | Date of the order | **orderPrice** | **float** | Price of the order | **orderId** | **int** | ID of the order | diff --git a/docs/Model/GetContactDetails.md b/docs/Model/GetContactDetails.md index 4542e053..32faa1eb 100644 --- a/docs/Model/GetContactDetails.md +++ b/docs/Model/GetContactDetails.md @@ -7,10 +7,10 @@ Name | Type | Description | Notes **id** | **int** | ID of the contact for which you requested the details | **emailBlacklisted** | **bool** | Blacklist status for email campaigns (true=blacklisted, false=not blacklisted) | **smsBlacklisted** | **bool** | Blacklist status for SMS campaigns (true=blacklisted, false=not blacklisted) | -**modifiedAt** | **\DateTime** | Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | [**\DateTime**] | Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | **listIds** | **int[]** | | **listUnsubscribed** | **int[]** | | [optional] -**attributes** | **map[string,string]** | | +**attributes** | **object** | Set of attributes of the contact | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetEmailCampaign.md b/docs/Model/GetEmailCampaign.md index dcc42fc8..36b25be7 100644 --- a/docs/Model/GetEmailCampaign.md +++ b/docs/Model/GetEmailCampaign.md @@ -8,18 +8,18 @@ Name | Type | Description | Notes **subject** | **string** | Subject of the campaign | **type** | **string** | Type of campaign | **status** | **string** | Status of the campaign | -**scheduledAt** | **\DateTime** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] +**scheduledAt** | [**\DateTime**] | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] **testSent** | **bool** | Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) | **header** | **string** | Header of the campaign | **footer** | **string** | Footer of the campaign | -**sender** | [**\SendinBlue\Client\Model\GetExtendedCampaignOverviewSender**](GetExtendedCampaignOverviewSender.md) | | [optional] +**sender** | [**\SendinBlue\Client\Model\GetExtendedCampaignOverviewSender**](GetExtendedCampaignOverviewSender.md) | | **replyTo** | **string** | Email defined as the \"Reply to\" of the campaign | **toField** | **string** | Customisation of the \"to\" field of the campaign | **htmlContent** | **string** | HTML content of the campaign | **shareLink** | **string** | Link to share the campaign on social medias | [optional] **tag** | **string** | Tag of the campaign | -**createdAt** | **\DateTime** | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **\DateTime** | UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**createdAt** | [**\DateTime**] | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | [**\DateTime**] | UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | **inlineImageActivation** | **bool** | Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email. | [optional] **mirrorActive** | **bool** | Status of mirror links in campaign. mirrorActive = false means mirror links are deactivated, & mirrorActive = true means mirror links are activated, in the campaign | [optional] **recurring** | **bool** | FOR TRIGGER ONLY ! Type of trigger campaign.recurring = false means contact can receive the same Trigger campaign only once, & recurring = true means contact can receive the same Trigger campaign several times | [optional] diff --git a/docs/Model/GetEmailEventReportEvents.md b/docs/Model/GetEmailEventReportEvents.md index 4ddb1e4e..52c1568f 100644 --- a/docs/Model/GetEmailEventReportEvents.md +++ b/docs/Model/GetEmailEventReportEvents.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **email** | **string** | Email address which generates the event | -**date** | **\DateTime** | UTC date-time on which the event has been generated | +**date** | [**\DateTime**] | UTC date-time on which the event has been generated | **subject** | **string** | Subject of the event | [optional] **messageId** | **string** | Message ID which generated the event | **event** | **string** | Event which occurred | **reason** | **string** | Reason of bounce (only available if the event is hardbounce or softbounce) | [optional] -**tag** | **string** | Tag of the email which generated the event | +**tag** | **string** | Tag of the email which generated the event | [optional] **ip** | **string** | IP from which the user has opened the email or clicked on the link (only available if the event is opened or clicks) | [optional] **link** | **string** | The link which is sent to the user (only available if the event is requests or opened or clicks) | [optional] -**from** | **string** | Sender email from which the emails are sent | +**from** | **string** | Sender email from which the emails are sent | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedCampaignOverview.md b/docs/Model/GetExtendedCampaignOverview.md index 2a837378..a918feb4 100644 --- a/docs/Model/GetExtendedCampaignOverview.md +++ b/docs/Model/GetExtendedCampaignOverview.md @@ -8,18 +8,18 @@ Name | Type | Description | Notes **subject** | **string** | Subject of the campaign | **type** | **string** | Type of campaign | **status** | **string** | Status of the campaign | -**scheduledAt** | **\DateTime** | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] +**scheduledAt** | [**\DateTime**] | UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) | [optional] **testSent** | **bool** | Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) | **header** | **string** | Header of the campaign | **footer** | **string** | Footer of the campaign | -**sender** | [**\SendinBlue\Client\Model\GetExtendedCampaignOverviewSender**](GetExtendedCampaignOverviewSender.md) | | [optional] +**sender** | [**\SendinBlue\Client\Model\GetExtendedCampaignOverviewSender**](GetExtendedCampaignOverviewSender.md) | | **replyTo** | **string** | Email defined as the \"Reply to\" of the campaign | **toField** | **string** | Customisation of the \"to\" field of the campaign | **htmlContent** | **string** | HTML content of the campaign | **shareLink** | **string** | Link to share the campaign on social medias | [optional] **tag** | **string** | Tag of the campaign | -**createdAt** | **\DateTime** | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **\DateTime** | UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**createdAt** | [**\DateTime**] | Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | [**\DateTime**] | UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | **inlineImageActivation** | **bool** | Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email. | [optional] **mirrorActive** | **bool** | Status of mirror links in campaign. mirrorActive = false means mirror links are deactivated, & mirrorActive = true means mirror links are activated, in the campaign | [optional] **recurring** | **bool** | FOR TRIGGER ONLY ! Type of trigger campaign.recurring = false means contact can receive the same Trigger campaign only once, & recurring = true means contact can receive the same Trigger campaign several times | [optional] diff --git a/docs/Model/GetExtendedCampaignStats.md b/docs/Model/GetExtendedCampaignStats.md index 0c3ecc88..ad600158 100644 --- a/docs/Model/GetExtendedCampaignStats.md +++ b/docs/Model/GetExtendedCampaignStats.md @@ -3,10 +3,11 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**campaignStats** | **object[]** | | +**globalStats** | **object** | Overall statistics of the campaign | +**campaignStats** | **object[]** | List-wise statistics of the campaign. | **mirrorClick** | **int** | Number of clicks on mirror link | **remaining** | **int** | Number of remaning emails to send | -**linksStats** | [**map[string,\SendinBlue\Client\Model\GetExtendedCampaignStatsLinksStats]**](GetExtendedCampaignStatsLinksStats.md) | | +**linksStats** | **object** | Statistics about the number of clicks for the links | **statsByDomain** | [**\SendinBlue\Client\Model\GetStatsByDomain**](GetStatsByDomain.md) | | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedCampaignStatsLinksStats.md b/docs/Model/GetExtendedCampaignStatsLinksStats.md deleted file mode 100644 index 5da3f6e1..00000000 --- a/docs/Model/GetExtendedCampaignStatsLinksStats.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetExtendedCampaignStatsLinksStats - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**nbClick** | **int** | Number of clicks for the link | - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - - diff --git a/docs/Model/GetExtendedClient.md b/docs/Model/GetExtendedClient.md index 24fc49f5..fc083e86 100644 --- a/docs/Model/GetExtendedClient.md +++ b/docs/Model/GetExtendedClient.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **firstName** | **string** | First Name | **lastName** | **string** | Last Name | **companyName** | **string** | Name of the company | -**address** | [**\SendinBlue\Client\Model\GetExtendedClientAddress**](GetExtendedClientAddress.md) | | [optional] +**address** | [**\SendinBlue\Client\Model\GetExtendedClientAddress**](GetExtendedClientAddress.md) | | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetails.md b/docs/Model/GetExtendedContactDetails.md index 524a1d18..9895d1e4 100644 --- a/docs/Model/GetExtendedContactDetails.md +++ b/docs/Model/GetExtendedContactDetails.md @@ -7,11 +7,11 @@ Name | Type | Description | Notes **id** | **int** | ID of the contact for which you requested the details | **emailBlacklisted** | **bool** | Blacklist status for email campaigns (true=blacklisted, false=not blacklisted) | **smsBlacklisted** | **bool** | Blacklist status for SMS campaigns (true=blacklisted, false=not blacklisted) | -**modifiedAt** | **\DateTime** | Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | [**\DateTime**] | Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) | **listIds** | **int[]** | | **listUnsubscribed** | **int[]** | | [optional] -**attributes** | **map[string,string]** | | -**statistics** | [**\SendinBlue\Client\Model\GetExtendedContactDetailsStatistics**](GetExtendedContactDetailsStatistics.md) | | [optional] +**attributes** | **object** | Set of attributes of the contact | +**statistics** | [**\SendinBlue\Client\Model\GetExtendedContactDetailsStatistics**](GetExtendedContactDetailsStatistics.md) | | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsStatisticsLinks.md b/docs/Model/GetExtendedContactDetailsStatisticsLinks.md index 99b305bb..68583c5a 100644 --- a/docs/Model/GetExtendedContactDetailsStatisticsLinks.md +++ b/docs/Model/GetExtendedContactDetailsStatisticsLinks.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **count** | **int** | Number of clicks on this link for the campaign | -**eventTime** | **\DateTime** | UTC date-time of the event | +**eventTime** | [**\DateTime**] | UTC date-time of the event | **ip** | **string** | IP from which the user has clicked on the link | **url** | **string** | URL of the clicked link | diff --git a/docs/Model/GetExtendedContactDetailsStatisticsMessagesSent.md b/docs/Model/GetExtendedContactDetailsStatisticsMessagesSent.md index be7585a8..baac9196 100644 --- a/docs/Model/GetExtendedContactDetailsStatisticsMessagesSent.md +++ b/docs/Model/GetExtendedContactDetailsStatisticsMessagesSent.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **campaignId** | **int** | ID of the campaign which generated the event | -**eventTime** | **\DateTime** | UTC date-time of the event | +**eventTime** | [**\DateTime**] | UTC date-time of the event | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsStatisticsOpened.md b/docs/Model/GetExtendedContactDetailsStatisticsOpened.md index 67858578..4aa7256a 100644 --- a/docs/Model/GetExtendedContactDetailsStatisticsOpened.md +++ b/docs/Model/GetExtendedContactDetailsStatisticsOpened.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **campaignId** | **int** | ID of the campaign which generated the event | **count** | **int** | Number of openings for the campaign | -**eventTime** | **\DateTime** | UTC date-time of the event | +**eventTime** | [**\DateTime**] | UTC date-time of the event | **ip** | **string** | IP from which the user has opened the email | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md b/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md index c49a59fa..8d677f62 100644 --- a/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md +++ b/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**eventTime** | **\DateTime** | UTC date-time of the event | +**eventTime** | [**\DateTime**] | UTC date-time of the event | **ip** | **string** | IP from which the user has been unsubscribed | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md b/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md index 3e4a3f40..1d57b6ce 100644 --- a/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md +++ b/docs/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **campaignId** | **int** | ID of the campaign which generated the event | -**eventTime** | **\DateTime** | UTC date-time of the event | +**eventTime** | [**\DateTime**] | UTC date-time of the event | **ip** | **string** | IP from which the user has unsubscribed | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetExtendedList.md b/docs/Model/GetExtendedList.md index 60bb1473..b2668981 100644 --- a/docs/Model/GetExtendedList.md +++ b/docs/Model/GetExtendedList.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **totalBlacklisted** | **int** | Number of blacklisted contacts in the list | **totalSubscribers** | **int** | Number of contacts in the list | **folderId** | **int** | ID of the folder | -**createdAt** | **\DateTime** | Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**createdAt** | [**\DateTime**] | Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) | **campaignStats** | [**\SendinBlue\Client\Model\GetExtendedListCampaignStats[]**](GetExtendedListCampaignStats.md) | | [optional] **dynamicList** | **bool** | Status telling if the list is dynamic or not (true=dynamic, false=not dynamic) | [optional] diff --git a/docs/Model/GetReportsReports.md b/docs/Model/GetReportsReports.md index 1f7d19b4..98cf2057 100644 --- a/docs/Model/GetReportsReports.md +++ b/docs/Model/GetReportsReports.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**date** | **\DateTime** | Date of the statistics | +**date** | [**\DateTime**] | Date of the statistics | **requests** | **int** | Number of requests for the date | **delivered** | **int** | Number of delivered emails for the date | **hardBounces** | **int** | Number of hardbounces for the date | diff --git a/docs/Model/GetSmsCampaign.md b/docs/Model/GetSmsCampaign.md index e3276c2f..c8eb7037 100644 --- a/docs/Model/GetSmsCampaign.md +++ b/docs/Model/GetSmsCampaign.md @@ -7,11 +7,11 @@ Name | Type | Description | Notes **name** | **string** | Name of the SMS Campaign | **status** | **string** | Status of the SMS Campaign | **content** | **string** | Content of the SMS Campaign | -**scheduledAt** | **\DateTime** | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | +**scheduledAt** | [**\DateTime**] | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | **testSent** | **bool** | Retrieved the status of test SMS sending. (true=Test SMS has been sent false=Test SMS has not been sent) | **sender** | **string** | Sender of the SMS Campaign | -**createdAt** | **\DateTime** | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **\DateTime** | UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**createdAt** | [**\DateTime**] | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | [**\DateTime**] | UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | **recipients** | **object** | | **statistics** | **object** | | diff --git a/docs/Model/GetSmsCampaignOverview.md b/docs/Model/GetSmsCampaignOverview.md index 52f1ee45..1cc92d36 100644 --- a/docs/Model/GetSmsCampaignOverview.md +++ b/docs/Model/GetSmsCampaignOverview.md @@ -7,11 +7,11 @@ Name | Type | Description | Notes **name** | **string** | Name of the SMS Campaign | **status** | **string** | Status of the SMS Campaign | **content** | **string** | Content of the SMS Campaign | -**scheduledAt** | **\DateTime** | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | +**scheduledAt** | [**\DateTime**] | UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format | **testSent** | **bool** | Retrieved the status of test SMS sending. (true=Test SMS has been sent false=Test SMS has not been sent) | **sender** | **string** | Sender of the SMS Campaign | -**createdAt** | **\DateTime** | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **\DateTime** | UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**createdAt** | [**\DateTime**] | Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | [**\DateTime**] | UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetSmsEventReportEvents.md b/docs/Model/GetSmsEventReportEvents.md index 293b5f91..1e32fa09 100644 --- a/docs/Model/GetSmsEventReportEvents.md +++ b/docs/Model/GetSmsEventReportEvents.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **phoneNumber** | **string** | Phone number which has generated the event | -**date** | **\DateTime** | Date on which the event has been generated | +**date** | [**\DateTime**] | Date on which the event has been generated | **messageId** | **string** | Message ID which generated the event | **event** | **string** | Event which occurred | **reason** | **string** | Reason of bounce (only available if the event is hardbounce or softbounce) | [optional] diff --git a/docs/Model/GetSmtpTemplateOverview.md b/docs/Model/GetSmtpTemplateOverview.md index 2af56aaf..3df9f8d1 100644 --- a/docs/Model/GetSmtpTemplateOverview.md +++ b/docs/Model/GetSmtpTemplateOverview.md @@ -8,13 +8,13 @@ Name | Type | Description | Notes **subject** | **string** | Subject of the template | **isActive** | **bool** | Status of template (true=active, false=inactive) | **testSent** | **bool** | Status of test sending for the template (true=test email has been sent, false=test email has not been sent) | -**sender** | [**\SendinBlue\Client\Model\GetSmtpTemplateOverviewSender**](GetSmtpTemplateOverviewSender.md) | | [optional] +**sender** | [**\SendinBlue\Client\Model\GetSmtpTemplateOverviewSender**](GetSmtpTemplateOverviewSender.md) | | **replyTo** | **string** | Email defined as the \"Reply to\" for the template | **toField** | **string** | Customisation of the \"to\" field for the template | **tag** | **string** | Tag of the template | **htmlContent** | **string** | HTML content of the template | -**createdAt** | **\DateTime** | Creation UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **\DateTime** | Last modification UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**createdAt** | [**\DateTime**] | Creation UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | [**\DateTime**] | Last modification UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetTransacSmsReportReports.md b/docs/Model/GetTransacSmsReportReports.md index a240fd54..12194da1 100644 --- a/docs/Model/GetTransacSmsReportReports.md +++ b/docs/Model/GetTransacSmsReportReports.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**date** | **\DateTime** | Date for which statistics are retrieved | +**date** | [**\DateTime**] | Date for which statistics are retrieved | **requests** | **int** | Number of requests for the date | **delivered** | **int** | Number of delivered SMS for the date | **hardBounces** | **int** | Number of hardbounces for the date | diff --git a/docs/Model/GetWebhook.md b/docs/Model/GetWebhook.md index 6f82a716..8831f3cd 100644 --- a/docs/Model/GetWebhook.md +++ b/docs/Model/GetWebhook.md @@ -8,8 +8,8 @@ Name | Type | Description | Notes **description** | **string** | Description of the webhook | **events** | **string[]** | | **type** | **string** | Type of webhook (marketing or transac) | -**createdAt** | **\DateTime** | Creation UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) | -**modifiedAt** | **\DateTime** | Last modification UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**createdAt** | [**\DateTime**] | Creation UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) | +**modifiedAt** | [**\DateTime**] | Last modification UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ManageIp.md b/docs/Model/ManageIp.md index fddf0375..797f01c5 100644 --- a/docs/Model/ManageIp.md +++ b/docs/Model/ManageIp.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ipId** | **int** | ID of the IP | [optional] +**ip** | **string** | Dedicated ID | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PostContactInfo.md b/docs/Model/PostContactInfo.md index 2ff866f7..1df31d9c 100644 --- a/docs/Model/PostContactInfo.md +++ b/docs/Model/PostContactInfo.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**contacts** | [**\SendinBlue\Client\Model\PostContactInfoContacts**](PostContactInfoContacts.md) | | [optional] +**contacts** | [**\SendinBlue\Client\Model\PostContactInfoContacts**](PostContactInfoContacts.md) | | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RemainingCreditModel.md b/docs/Model/RemainingCreditModel.md index 9bdbb1a2..fa43b135 100644 --- a/docs/Model/RemainingCreditModel.md +++ b/docs/Model/RemainingCreditModel.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**child** | [**\SendinBlue\Client\Model\RemainingCreditModelChild**](RemainingCreditModelChild.md) | | [optional] -**reseller** | [**\SendinBlue\Client\Model\RemainingCreditModelReseller**](RemainingCreditModelReseller.md) | | [optional] +**child** | [**\SendinBlue\Client\Model\RemainingCreditModelChild**](RemainingCreditModelChild.md) | | +**reseller** | [**\SendinBlue\Client\Model\RemainingCreditModelReseller**](RemainingCreditModelReseller.md) | | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RemoveCredits.md b/docs/Model/RemoveCredits.md index 32c2a413..3cbac52f 100644 --- a/docs/Model/RemoveCredits.md +++ b/docs/Model/RemoveCredits.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**sms** | **int** | SMS credits to be removed from the child account | [optional] -**email** | **int** | Email credits to be removed from the child account | [optional] +**sms** | **int** | Required if email credits are empty. SMS credits to be removed from the child account | [optional] +**email** | **int** | Required if sms credits are empty. Email credits to be removed from the child account | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RequestContactExport.md b/docs/Model/RequestContactExport.md index e454e616..0f24d6a6 100644 --- a/docs/Model/RequestContactExport.md +++ b/docs/Model/RequestContactExport.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**exportAttributes** | **string[]** | Name of attributes to export. These attributes must be in your contact database | [optional] -**contactFilter** | **object** | Filter to apply to the export | +**exportAttributes** | **string[]** | List of all the attributes that you want to export. These attributes must be present in your contact database. For example, ['fname', 'lname', 'email']. | [optional] +**contactFilter** | **object** | Set the filter for the contacts to be exported. For example, {'blacklisted':true} will export all the blacklisted contacts. | **notifyUrl** | **string** | Webhook that will be called once the export process is finished | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RequestContactImport.md b/docs/Model/RequestContactImport.md index b396739a..e0b45506 100644 --- a/docs/Model/RequestContactImport.md +++ b/docs/Model/RequestContactImport.md @@ -3,11 +3,14 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**fileUrl** | **string** | Mandatory if fileBody not defined. URL of the file to be imported (no local file). Possible file types: .txt, .csv | [optional] +**fileUrl** | **string** | Mandatory if fileBody is not defined. URL of the file to be imported (no local file). Possible file formats: .txt, .csv | [optional] **fileBody** | **string** | Mandatory if fileUrl is not defined. CSV content to be imported. Use semicolon to separate multiple attributes | [optional] -**listIds** | **int[]** | Manadatory if newList is not defined. Ids of the lists in which to add the contacts | [optional] +**listIds** | **int[]** | Mandatory if newList is not defined. Ids of the lists in which the contacts shall be imported. For example, [2, 4, 7]. | [optional] **notifyUrl** | **string** | URL that will be called once the export process is finished | [optional] **newList** | [**\SendinBlue\Client\Model\RequestContactImportNewList**](RequestContactImportNewList.md) | | [optional] +**emailBlacklist** | **bool** | To blacklist all the contacts for email | [optional] [default to false] +**smsBlacklist** | **bool** | To blacklist all the contacts for sms | [optional] [default to false] +**updateExistingContacts** | **bool** | To facilitate the choice to update the existing contacts | [optional] [default to true] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RequestContactImportNewList.md b/docs/Model/RequestContactImportNewList.md index 9df6c9c6..049ee8fe 100644 --- a/docs/Model/RequestContactImportNewList.md +++ b/docs/Model/RequestContactImportNewList.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **listName** | **string** | List with listName will be created first and users will be imported in it (Mandatory if listIds is empty). | [optional] -**folderId** | **int** | Folder id will be used with listName to make newly created list’s desired parent (Mandatory if listName is not empty). | [optional] +**folderId** | **int** | Id of the folder where this new list shall be created (Mandatory if listName is not empty). | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendEmail.md b/docs/Model/SendEmail.md index d2861036..962b972d 100644 --- a/docs/Model/SendEmail.md +++ b/docs/Model/SendEmail.md @@ -3,14 +3,15 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**emailTo** | **string[]** | Email addresses of the recipients | -**emailBcc** | **string[]** | Email addresses of the recipients in bcc | [optional] -**emailCc** | **string[]** | Email addresses of the recipients in cc | [optional] -**replyTo** | **string** | Email on which campaign recipients will be able to reply to | [optional] +**emailTo** | **string[]** | List of the email addresses of the recipients. For example, ['abc@example.com', 'asd@example.com']. | +**emailBcc** | **string[]** | List of the email addresses of the recipients in bcc | [optional] +**emailCc** | **string[]** | List of the email addresses of the recipients in cc | [optional] +**replyTo** | **string** | Email address which shall be used by campaign recipients to reply back | [optional] **attachmentUrl** | **string** | Absolute url of the attachment (no local file). Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps | [optional] -**attachment** | [**\SendinBlue\Client\Model\SendEmailAttachment[]**](SendEmailAttachment.md) | Pass the base64 content of the attachment. Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps | [optional] -**headers** | **map[string,string]** | | [optional] -**attributes** | **map[string,string]** | | [optional] +**attachment** | [**\SendinBlue\Client\Model\SendEmailAttachment[]**](SendEmailAttachment.md) | Pass the list of content (base64 encoded) and name of the attachment. For example, [{'content':'base64 encoded content 1', 'name':'attcahment1'}, {'content':'base64 encoded content 2', 'name':'attcahment2'}]. | [optional] +**headers** | **object** | Pass the set of headers that shall be sent along the mail headers in the original email. 'X-Mailin-IP' header can be set (only for dedicated ip users) to mention the IP to be used for sending transactional emails. For example, {'Content-Type':'text/html', 'charset':'iso-8859-1', 'X-Mailin-IP':'1.2.3.4'} | [optional] +**attributes** | **object** | Pass the set of attributes to customize the template. For example, {'FNAME':'Joe', 'LNAME':'Doe'} | [optional] +**tags** | **string[]** | Tag your emails to find them more easily | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendEmailAttachment.md b/docs/Model/SendEmailAttachment.md index ea57bbb8..250e525e 100644 --- a/docs/Model/SendEmailAttachment.md +++ b/docs/Model/SendEmailAttachment.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | **string** | Base64 encoded chunk data of the attachment generated on the fly | [optional] -**name** | **string** | Required for content. Name of the attachment | [optional] +**content** | **string** | Base64 encoded chunk data of the attachment generated on the fly | +**name** | **string** | Required for content. Name of the attachment | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendReport.md b/docs/Model/SendReport.md index 22418bc2..201dba47 100644 --- a/docs/Model/SendReport.md +++ b/docs/Model/SendReport.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **language** | **string** | Language of email content for campaign report sending. | [optional] [default to 'fr'] -**email** | [**\SendinBlue\Client\Model\SendReportEmail**](SendReportEmail.md) | | [optional] +**email** | [**\SendinBlue\Client\Model\SendReportEmail**](SendReportEmail.md) | | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmail.md b/docs/Model/SendSmtpEmail.md index d58531ec..93e9de1a 100644 --- a/docs/Model/SendSmtpEmail.md +++ b/docs/Model/SendSmtpEmail.md @@ -4,17 +4,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **sender** | [**\SendinBlue\Client\Model\SendSmtpEmailSender**](SendSmtpEmailSender.md) | | [optional] -**to** | [**\SendinBlue\Client\Model\SendSmtpEmailTo[]**](SendSmtpEmailTo.md) | Email addresses and names of the recipients | -**bcc** | [**\SendinBlue\Client\Model\SendSmtpEmailBcc[]**](SendSmtpEmailBcc.md) | Email addresses and names of the recipients in bcc | [optional] -**cc** | [**\SendinBlue\Client\Model\SendSmtpEmailCc[]**](SendSmtpEmailCc.md) | Email addresses and names of the recipients in cc | [optional] +**to** | [**\SendinBlue\Client\Model\SendSmtpEmailTo[]**](SendSmtpEmailTo.md) | List of email addresses and names (optional) of the recipients. For example, [{'name':'Jimmy', 'email':'jimmy98@example.com'}, {'name':'Joe', 'email':'joe@example.com'}] | +**bcc** | [**\SendinBlue\Client\Model\SendSmtpEmailBcc[]**](SendSmtpEmailBcc.md) | List of email addresses and names (optional) of the recipients in bcc | [optional] +**cc** | [**\SendinBlue\Client\Model\SendSmtpEmailCc[]**](SendSmtpEmailCc.md) | List of email addresses and names (optional) of the recipients in cc | [optional] **htmlContent** | **string** | HTML body of the message ( Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed ) | [optional] **textContent** | **string** | Plain Text body of the message ( Ignored if 'templateId' is passed ) | [optional] **subject** | **string** | Subject of the message. Mandatory if 'templateId' is not passed | [optional] **replyTo** | [**\SendinBlue\Client\Model\SendSmtpEmailReplyTo**](SendSmtpEmailReplyTo.md) | | [optional] -**attachment** | [**\SendinBlue\Client\Model\SendSmtpEmailAttachment[]**](SendSmtpEmailAttachment.md) | Pass the absolute URL (no local file) or the base64 content of the attachment. Name can be used in both cases to define the attachment name. It is mandatory in case of content. Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps ( Ignored if 'templateId' is passed ) | [optional] -**headers** | **map[string,string]** | | [optional] +**attachment** | [**\SendinBlue\Client\Model\SendSmtpEmailAttachment[]**](SendSmtpEmailAttachment.md) | Pass the absolute URL (no local file) or the base64 content of the attachment along with the attachment name (Mandatory if attachment content is passed). For example, [{'url':'https://attachment.domain.com/myAttachmentFromUrl.jpg', 'name':'My attachment 1'}, {'content':'base64 exmaple content', 'name':'My attachment 2'}]. Allowed extensions for attachment file: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps ( Ignored if 'templateId' is passed ) | [optional] +**headers** | **object** | Pass the set of headers that shall be sent along the mail headers in the original email. 'X-Mailin-IP' header can be set (only for dedicated ip users) to mention the IP to be used for sending transactional emails. For example, {'Content-Type':'text/html', 'charset':'iso-8859-1', 'X-Mailin-IP':'1.2.3.4'} | [optional] **templateId** | **int** | Id of the template | [optional] -**params** | **map[string,string]** | | [optional] +**params** | **object** | Pass the set of attributes to customize the template. For example, {'FNAME':'Joe', 'LNAME':'Doe'}. | [optional] +**tags** | **string[]** | Tag your emails to find them more easily | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailAttachment.md b/docs/Model/SendSmtpEmailAttachment.md index 1bbb416b..713d2cff 100644 --- a/docs/Model/SendSmtpEmailAttachment.md +++ b/docs/Model/SendSmtpEmailAttachment.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **url** | **string** | Absolute url of the attachment (no local file). | [optional] **content** | **string** | Base64 encoded chunk data of the attachment generated on the fly | [optional] -**name** | **string** | Required for content. Name of the attachment | [optional] +**name** | **string** | Required if content is passed. Name of the attachment | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendSmtpEmailSender.md b/docs/Model/SendSmtpEmailSender.md index 225bd506..ab8a02e7 100644 --- a/docs/Model/SendSmtpEmailSender.md +++ b/docs/Model/SendSmtpEmailSender.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Sender Name from which the emails are sent | [optional] -**email** | **string** | Sender Email from which the emails are sent | +**name** | **string** | Name of the sender from which the emails will be sent | [optional] +**email** | **string** | Email of the sender from which the emails will be sent | [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SendTestEmail.md b/docs/Model/SendTestEmail.md index b06d6524..fd2b0094 100644 --- a/docs/Model/SendTestEmail.md +++ b/docs/Model/SendTestEmail.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**emailTo** | **string[]** | If empty the test email will be sent to your entire test list. Use this field to send it to specific addresses in your list. | [optional] +**emailTo** | **string[]** | List of the email addresses of the recipients whom you wish to send the test mail. If left empty, the test mail will be sent to your entire test list. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateAttribute.md b/docs/Model/UpdateAttribute.md index c920280a..705ae978 100644 --- a/docs/Model/UpdateAttribute.md +++ b/docs/Model/UpdateAttribute.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**value** | **string** | Value of the attribute. Use only if the attribute's category is calculated or global | [optional] -**enumeration** | [**\SendinBlue\Client\Model\UpdateAttributeEnumeration[]**](UpdateAttributeEnumeration.md) | Values that the attribute can take. Use only if the attribute's category is category | [optional] +**value** | **string** | Value of the attribute to update. Use only if the attribute's category is 'calculated' or 'global' | [optional] +**enumeration** | [**\SendinBlue\Client\Model\UpdateAttributeEnumeration[]**](UpdateAttributeEnumeration.md) | List of the values and labels that the attribute can take. Use only if the attribute's category is \"category\". For example, [{'value':1, 'label':'male'}, {'value':2, 'label':'female'}] | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateChild.md b/docs/Model/UpdateChild.md index 3303fecf..ef478b5a 100644 --- a/docs/Model/UpdateChild.md +++ b/docs/Model/UpdateChild.md @@ -8,7 +8,6 @@ Name | Type | Description | Notes **lastName** | **string** | New Last name to use to update the child account | [optional] **companyName** | **string** | New Company name to use to update the child account | [optional] **password** | **string** | New password for the child account to login | [optional] -**ips** | **int[]** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateContact.md b/docs/Model/UpdateContact.md index 7b691259..9618e1a7 100644 --- a/docs/Model/UpdateContact.md +++ b/docs/Model/UpdateContact.md @@ -3,9 +3,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**attributes** | **map[string,string]** | | [optional] -**emailBlacklisted** | **bool** | Blacklist the contact for emails (emailBlacklisted = true) | [optional] -**smsBlacklisted** | **bool** | Blacklist the contact for SMS (smsBlacklisted = true) | [optional] +**attributes** | **object** | Pass the set of attributes to be updated. These attributes must be present in your account. For eg. {'FNAME':'Ellie', 'LNAME':'Roger'} | [optional] +**emailBlacklisted** | **bool** | Set/unset this field to blacklist/allow the contact for emails (emailBlacklisted = true) | [optional] +**smsBlacklisted** | **bool** | Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true) | [optional] **listIds** | **int[]** | Ids of the lists to add the contact to | [optional] **unlinkListIds** | **int[]** | Ids of the lists to remove the contact from | [optional] **smtpBlacklistSender** | **string[]** | SMTP forbidden sender for contact. Use only for email Contact | [optional] diff --git a/docs/Model/UpdateEmailCampaign.md b/docs/Model/UpdateEmailCampaign.md index f0631970..455a6a67 100644 --- a/docs/Model/UpdateEmailCampaign.md +++ b/docs/Model/UpdateEmailCampaign.md @@ -8,10 +8,10 @@ Name | Type | Description | Notes **name** | **string** | Name of the campaign | [optional] **htmlContent** | **string** | Body of the message (HTML version). REQUIRED if htmlUrl is empty | [optional] **htmlUrl** | **string** | Url which contents the body of the email message. REQUIRED if htmlContent is empty | [optional] -**scheduledAt** | **\DateTime** | UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. | [optional] +**scheduledAt** | [**\DateTime**] | UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. | [optional] **subject** | **string** | Subject of the campaign | [optional] **replyTo** | **string** | Email on which campaign recipients will be able to reply to | [optional] -**toField** | **string** | This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [FNAME] [LNAME]. To use the contact attributes here, these must already exist in SendinBlue account | [optional] +**toField** | **string** | This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. To use the contact attributes here, these must already exist in SendinBlue account | [optional] **recipients** | [**\SendinBlue\Client\Model\UpdateEmailCampaignRecipients**](UpdateEmailCampaignRecipients.md) | | [optional] **attachmentUrl** | **string** | Absolute url of the attachment (no local file). Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps | [optional] **inlineImageActivation** | **bool** | Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email. You cannot send a campaign of more than 4MB with images embedded in the email. Campaigns with the images embedded in the email must be sent to less than 5000 contacts. | [optional] [default to false] diff --git a/docs/Model/UpdateList.md b/docs/Model/UpdateList.md index a9c1bc13..de3f2c83 100644 --- a/docs/Model/UpdateList.md +++ b/docs/Model/UpdateList.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **string** | Name of the list. Only one parameter can be update at once | [optional] -**folderId** | **int** | Id of the folder in which to move the list. Only one parameter can updated at once | [optional] +**name** | **string** | Name of the list. Either of the two parameters (name, folderId) can be updated at a time. | [optional] +**folderId** | **int** | Id of the folder in which the list is to be moved. Either of the two parameters (name, folderId) can be updated at a time. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateSmsCampaign.md b/docs/Model/UpdateSmsCampaign.md index 685f2a8f..6064a5b5 100644 --- a/docs/Model/UpdateSmsCampaign.md +++ b/docs/Model/UpdateSmsCampaign.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **sender** | **string** | Name of the sender. The number of characters is limited to 11 | [optional] **content** | **string** | Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS | [optional] **recipients** | [**\SendinBlue\Client\Model\CreateSmsCampaignRecipients**](CreateSmsCampaignRecipients.md) | | [optional] -**scheduledAt** | **\DateTime** | UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. | [optional] +**scheduledAt** | [**\DateTime**] | UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateSmtpTemplate.md b/docs/Model/UpdateSmtpTemplate.md index c130ede1..ed87b03a 100644 --- a/docs/Model/UpdateSmtpTemplate.md +++ b/docs/Model/UpdateSmtpTemplate.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **htmlUrl** | **string** | Required if htmlContent is empty. URL to the body of the email (HTML) | [optional] **subject** | **string** | Subject of the email | [optional] **replyTo** | **string** | Email on which campaign recipients will be able to reply to | [optional] -**toField** | **string** | To personalize the «To» Field, e.g. if you want to include the first name and last name of your recipient, add [FNAME] [LNAME]. These attributes must already exist in contacts database | [optional] +**toField** | **string** | To personalize the «To» Field, e.g. if you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These attributes must already exist in contacts database | [optional] **attachmentUrl** | **string** | Absolute url of the attachment (no local file). Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps | [optional] **isActive** | **bool** | Status of the template. isActive = false means template is inactive, isActive = true means template is active | [optional] diff --git a/lib/Api/AccountApi.php b/lib/Api/AccountApi.php index 28fe8bb5..8064663a 100644 --- a/lib/Api/AccountApi.php +++ b/lib/Api/AccountApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * AccountApi Class Doc Comment @@ -44,47 +50,36 @@ class AccountApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return AccountApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,7 +87,9 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Get your account informations, plans and credits details * + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetAccount */ public function getAccount() @@ -106,57 +103,249 @@ public function getAccount() * * Get your account informations, plans and credits details * + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetAccount, HTTP status code, HTTP response headers (array of strings) */ public function getAccountWithHttpInfo() { - // parse inputs - $resourcePath = "/account"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\GetAccount'; + $request = $this->getAccountRequest(); + + 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\GetAccount', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAccountAsync + * + * Get your account informations, plans and credits details + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAccountAsync() + { + return $this->getAccountAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAccountAsyncWithHttpInfo + * + * Get your account informations, plans and credits details + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAccountAsyncWithHttpInfo() + { + $returnType = '\SendinBlue\Client\Model\GetAccount'; + $request = $this->getAccountRequest(); + + 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 'getAccount' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getAccountRequest() + { + + $resourcePath = '/account'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetAccount', - '/account' - ); - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetAccount', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetAccount', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/AttributesApi.php b/lib/Api/AttributesApi.php index 9b74896a..f09e273f 100644 --- a/lib/Api/AttributesApi.php +++ b/lib/Api/AttributesApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * AttributesApi Class Doc Comment @@ -44,47 +50,36 @@ class AttributesApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return AttributesApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,16 +87,17 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Creates contact attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the attribute (required) - * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ public function createAttribute($attributeCategory, $attributeName, $createAttribute) { - list($response) = $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute); - return $response; + $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute); } /** @@ -109,94 +105,252 @@ public function createAttribute($attributeCategory, $attributeName, $createAttri * * Creates contact attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the attribute (required) - * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + { + $returnType = ''; + $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute); + + 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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAttributeAsync + * + * Creates contact attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAttributeAsync($attributeCategory, $attributeName, $createAttribute) + { + return $this->createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAttributeAsyncWithHttpInfo + * + * Creates contact attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + { + $returnType = ''; + $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'createAttribute' + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createAttributeRequest($attributeCategory, $attributeName, $createAttribute) { // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeCategory when calling createAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeCategory when calling createAttribute' + ); } // verify the required parameter 'attributeName' is set if ($attributeName === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeName when calling createAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeName when calling createAttribute' + ); } // verify the required parameter 'createAttribute' is set if ($createAttribute === null) { - throw new \InvalidArgumentException('Missing the required parameter $createAttribute when calling createAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createAttribute when calling createAttribute' + ); } - // parse inputs - $resourcePath = "/contacts/attributes/{attributeCategory}/{attributeName}"; - $httpBody = ''; + + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( - "{" . "attributeCategory" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeCategory), + '{' . 'attributeCategory' . '}', + ObjectSerializer::toPathValue($attributeCategory), $resourcePath ); } // path params if ($attributeName !== null) { $resourcePath = str_replace( - "{" . "attributeName" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeName), + '{' . 'attributeName' . '}', + ObjectSerializer::toPathValue($attributeName), $resourcePath ); } + // body params $_tempBody = null; if (isset($createAttribute)) { $_tempBody = $createAttribute; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/attributes/{attributeCategory}/{attributeName}' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -204,15 +358,16 @@ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, * * Deletes an attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ public function deleteAttribute($attributeCategory, $attributeName) { - list($response) = $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName); - return $response; + $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName); } /** @@ -220,88 +375,247 @@ public function deleteAttribute($attributeCategory, $attributeName) * * Deletes an attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName) + { + $returnType = ''; + $request = $this->deleteAttributeRequest($attributeCategory, $attributeName); + + 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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + 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 deleteAttributeAsync + * + * Deletes an attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAttributeAsync($attributeCategory, $attributeName) + { + return $this->deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteAttributeAsyncWithHttpInfo + * + * Deletes an attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName) + { + $returnType = ''; + $request = $this->deleteAttributeRequest($attributeCategory, $attributeName); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteAttribute' + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteAttributeRequest($attributeCategory, $attributeName) { // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeCategory when calling deleteAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeCategory when calling deleteAttribute' + ); } // verify the required parameter 'attributeName' is set if ($attributeName === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeName when calling deleteAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeName when calling deleteAttribute' + ); } - // parse inputs - $resourcePath = "/contacts/attributes/{attributeCategory}/{attributeName}"; - $httpBody = ''; + + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( - "{" . "attributeCategory" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeCategory), + '{' . 'attributeCategory' . '}', + ObjectSerializer::toPathValue($attributeCategory), $resourcePath ); } // path params if ($attributeName !== null) { $resourcePath = str_replace( - "{" . "attributeName" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeName), + '{' . 'attributeName' . '}', + ObjectSerializer::toPathValue($attributeName), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/attributes/{attributeCategory}/{attributeName}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -309,7 +623,9 @@ public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName) * * Lists all attributes * + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetAttributes */ public function getAttributes() @@ -323,58 +639,231 @@ public function getAttributes() * * Lists all attributes * + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetAttributes, HTTP status code, HTTP response headers (array of strings) */ public function getAttributesWithHttpInfo() { - // parse inputs - $resourcePath = "/contacts/attributes"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\GetAttributes'; + $request = $this->getAttributesRequest(); + + 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\GetAttributes', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAttributesAsync + * + * Lists all attributes + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttributesAsync() + { + return $this->getAttributesAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAttributesAsyncWithHttpInfo + * + * Lists all attributes + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttributesAsyncWithHttpInfo() + { + $returnType = '\SendinBlue\Client\Model\GetAttributes'; + $request = $this->getAttributesRequest(); + + 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 'getAttributes' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getAttributesRequest() + { + + $resourcePath = '/contacts/attributes'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetAttributes', - '/contacts/attributes' - ); - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetAttributes', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetAttributes', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; + $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 + ); } /** @@ -382,16 +871,17 @@ public function getAttributesWithHttpInfo() * * Updates contact attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ public function updateAttribute($attributeCategory, $attributeName, $updateAttribute) { - list($response) = $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute); - return $response; + $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute); } /** @@ -399,97 +889,278 @@ public function updateAttribute($attributeCategory, $attributeName, $updateAttri * * Updates contact attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + { + $returnType = ''; + $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute); + + 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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + 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 updateAttributeAsync + * + * Updates contact attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAttributeAsync($attributeCategory, $attributeName, $updateAttribute) + { + return $this->updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateAttributeAsyncWithHttpInfo + * + * Updates contact attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + { + $returnType = ''; + $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateAttribute' + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute) { // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeCategory when calling updateAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeCategory when calling updateAttribute' + ); } // verify the required parameter 'attributeName' is set if ($attributeName === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeName when calling updateAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeName when calling updateAttribute' + ); } // verify the required parameter 'updateAttribute' is set if ($updateAttribute === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateAttribute when calling updateAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateAttribute when calling updateAttribute' + ); } - // parse inputs - $resourcePath = "/contacts/attributes/{attributeCategory}/{attributeName}"; - $httpBody = ''; + + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( - "{" . "attributeCategory" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeCategory), + '{' . 'attributeCategory' . '}', + ObjectSerializer::toPathValue($attributeCategory), $resourcePath ); } // path params if ($attributeName !== null) { $resourcePath = str_replace( - "{" . "attributeName" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeName), + '{' . 'attributeName' . '}', + ObjectSerializer::toPathValue($attributeName), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateAttribute)) { $_tempBody = $updateAttribute; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/attributes/{attributeCategory}/{attributeName}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/ContactsApi.php b/lib/Api/ContactsApi.php index 6eba03c3..75135f09 100644 --- a/lib/Api/ContactsApi.php +++ b/lib/Api/ContactsApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * ContactsApi Class Doc Comment @@ -44,47 +50,36 @@ class ContactsApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return ContactsApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,9 +87,11 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Add existing contacts to a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\PostContactInfo */ public function addContactToList($listId, $contactEmails) @@ -108,89 +105,278 @@ public function addContactToList($listId, $contactEmails) * * Add existing contacts to a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings) */ public function addContactToListWithHttpInfo($listId, $contactEmails) + { + $returnType = '\SendinBlue\Client\Model\PostContactInfo'; + $request = $this->addContactToListRequest($listId, $contactEmails); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\PostContactInfo', + $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 addContactToListAsync + * + * Add existing contacts to a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addContactToListAsync($listId, $contactEmails) + { + return $this->addContactToListAsyncWithHttpInfo($listId, $contactEmails) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addContactToListAsyncWithHttpInfo + * + * Add existing contacts to a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addContactToListAsyncWithHttpInfo($listId, $contactEmails) + { + $returnType = '\SendinBlue\Client\Model\PostContactInfo'; + $request = $this->addContactToListRequest($listId, $contactEmails); + + 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 'addContactToList' + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function addContactToListRequest($listId, $contactEmails) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling addContactToList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling addContactToList' + ); } // verify the required parameter 'contactEmails' is set if ($contactEmails === null) { - throw new \InvalidArgumentException('Missing the required parameter $contactEmails when calling addContactToList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $contactEmails when calling addContactToList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}/contacts/add"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}/contacts/add'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $resourcePath ); } + // body params $_tempBody = null; if (isset($contactEmails)) { $_tempBody = $contactEmails; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\PostContactInfo', - '/contacts/lists/{listId}/contacts/add' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\PostContactInfo', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostContactInfo', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -198,16 +384,17 @@ public function addContactToListWithHttpInfo($listId, $contactEmails) * * Creates contact attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the attribute (required) - * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ public function createAttribute($attributeCategory, $attributeName, $createAttribute) { - list($response) = $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute); - return $response; + $this->createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute); } /** @@ -215,94 +402,252 @@ public function createAttribute($attributeCategory, $attributeName, $createAttri * * Creates contact attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the attribute (required) - * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + { + $returnType = ''; + $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute); + + 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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAttributeAsync + * + * Creates contact attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAttributeAsync($attributeCategory, $attributeName, $createAttribute) + { + return $this->createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAttributeAsyncWithHttpInfo + * + * Creates contact attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $createAttribute) + { + $returnType = ''; + $request = $this->createAttributeRequest($attributeCategory, $attributeName, $createAttribute); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'createAttribute' + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the attribute (required) + * @param \SendinBlue\Client\Model\CreateAttribute $createAttribute Values to create an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createAttributeRequest($attributeCategory, $attributeName, $createAttribute) { // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeCategory when calling createAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeCategory when calling createAttribute' + ); } // verify the required parameter 'attributeName' is set if ($attributeName === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeName when calling createAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeName when calling createAttribute' + ); } // verify the required parameter 'createAttribute' is set if ($createAttribute === null) { - throw new \InvalidArgumentException('Missing the required parameter $createAttribute when calling createAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createAttribute when calling createAttribute' + ); } - // parse inputs - $resourcePath = "/contacts/attributes/{attributeCategory}/{attributeName}"; - $httpBody = ''; + + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( - "{" . "attributeCategory" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeCategory), + '{' . 'attributeCategory' . '}', + ObjectSerializer::toPathValue($attributeCategory), $resourcePath ); } // path params if ($attributeName !== null) { $resourcePath = str_replace( - "{" . "attributeName" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeName), + '{' . 'attributeName' . '}', + ObjectSerializer::toPathValue($attributeName), $resourcePath ); } + // body params $_tempBody = null; if (isset($createAttribute)) { $_tempBody = $createAttribute; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/attributes/{attributeCategory}/{attributeName}' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -310,8 +655,10 @@ public function createAttributeWithHttpInfo($attributeCategory, $attributeName, * * Create a contact * - * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required) + * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateModel */ public function createContact($createContact) @@ -325,27 +672,181 @@ public function createContact($createContact) * * Create a contact * - * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required) + * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) */ public function createContactWithHttpInfo($createContact) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createContactRequest($createContact); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createContactAsync + * + * Create a contact + * + * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createContactAsync($createContact) + { + return $this->createContactAsyncWithHttpInfo($createContact) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createContactAsyncWithHttpInfo + * + * Create a contact + * + * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createContactAsyncWithHttpInfo($createContact) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createContactRequest($createContact); + + 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 'createContact' + * + * @param \SendinBlue\Client\Model\CreateContact $createContact Values to create a contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createContactRequest($createContact) { // verify the required parameter 'createContact' is set if ($createContact === null) { - throw new \InvalidArgumentException('Missing the required parameter $createContact when calling createContact'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createContact when calling createContact' + ); } - // parse inputs - $resourcePath = "/contacts"; - $httpBody = ''; + + $resourcePath = '/contacts'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -353,44 +854,70 @@ public function createContactWithHttpInfo($createContact) $_tempBody = $createContact; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/contacts' - ); - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -398,8 +925,10 @@ public function createContactWithHttpInfo($createContact) * * Create a folder * - * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateModel */ public function createFolder($createFolder) @@ -413,27 +942,181 @@ public function createFolder($createFolder) * * Create a folder * - * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) */ public function createFolderWithHttpInfo($createFolder) { - // verify the required parameter 'createFolder' is set + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createFolderRequest($createFolder); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createFolderAsync + * + * Create a folder + * + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createFolderAsync($createFolder) + { + return $this->createFolderAsyncWithHttpInfo($createFolder) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createFolderAsyncWithHttpInfo + * + * Create a folder + * + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createFolderAsyncWithHttpInfo($createFolder) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createFolderRequest($createFolder); + + 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 'createFolder' + * + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createFolderRequest($createFolder) + { + // verify the required parameter 'createFolder' is set if ($createFolder === null) { - throw new \InvalidArgumentException('Missing the required parameter $createFolder when calling createFolder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createFolder when calling createFolder' + ); } - // parse inputs - $resourcePath = "/contacts/folders"; - $httpBody = ''; + + $resourcePath = '/contacts/folders'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -441,87 +1124,269 @@ public function createFolderWithHttpInfo($createFolder) $_tempBody = $createFolder; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createList + * + * Create a list + * + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\CreateModel + */ + public function createList($createList) + { + list($response) = $this->createListWithHttpInfo($createList); + return $response; + } + + /** + * Operation createListWithHttpInfo + * + * Create a list + * + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + */ + public function createListWithHttpInfo($createList) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createListRequest($createList); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/contacts/folders' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation createList + * Operation createListAsync * * Create a list * - * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\CreateModel + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createList($createList) + public function createListAsync($createList) { - list($response) = $this->createListWithHttpInfo($createList); - return $response; + return $this->createListAsyncWithHttpInfo($createList) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation createListWithHttpInfo + * Operation createListAsyncWithHttpInfo * * Create a list * - * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createListWithHttpInfo($createList) + public function createListAsyncWithHttpInfo($createList) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createListRequest($createList); + + 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 'createList' + * + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createListRequest($createList) { // verify the required parameter 'createList' is set if ($createList === null) { - throw new \InvalidArgumentException('Missing the required parameter $createList when calling createList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createList when calling createList' + ); } - // parse inputs - $resourcePath = "/contacts/lists"; - $httpBody = ''; + + $resourcePath = '/contacts/lists'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -529,422 +1394,1073 @@ public function createListWithHttpInfo($createList) $_tempBody = $createList; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteAttribute + * + * Deletes an attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteAttribute($attributeCategory, $attributeName) + { + $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName); + } + + /** + * Operation deleteAttributeWithHttpInfo + * + * Deletes an attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName) + { + $returnType = ''; + $request = $this->deleteAttributeRequest($attributeCategory, $attributeName); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/contacts/lists' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteAttribute + * Operation deleteAttributeAsync * * Deletes an attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteAttribute($attributeCategory, $attributeName) + public function deleteAttributeAsync($attributeCategory, $attributeName) { - list($response) = $this->deleteAttributeWithHttpInfo($attributeCategory, $attributeName); - return $response; + return $this->deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteAttributeWithHttpInfo + * Operation deleteAttributeAsyncWithHttpInfo * * Deletes an attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName) + public function deleteAttributeAsyncWithHttpInfo($attributeCategory, $attributeName) + { + $returnType = ''; + $request = $this->deleteAttributeRequest($attributeCategory, $attributeName); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteAttribute' + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteAttributeRequest($attributeCategory, $attributeName) { // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeCategory when calling deleteAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeCategory when calling deleteAttribute' + ); } // verify the required parameter 'attributeName' is set if ($attributeName === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeName when calling deleteAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeName when calling deleteAttribute' + ); } - // parse inputs - $resourcePath = "/contacts/attributes/{attributeCategory}/{attributeName}"; - $httpBody = ''; + + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( - "{" . "attributeCategory" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeCategory), + '{' . 'attributeCategory' . '}', + ObjectSerializer::toPathValue($attributeCategory), $resourcePath ); } // path params if ($attributeName !== null) { $resourcePath = str_replace( - "{" . "attributeName" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeName), + '{' . 'attributeName' . '}', + ObjectSerializer::toPathValue($attributeName), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteContact + * + * Deletes a contact + * + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteContact($email) + { + $this->deleteContactWithHttpInfo($email); + } + + /** + * Operation deleteContactWithHttpInfo + * + * Deletes a contact + * + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteContactWithHttpInfo($email) + { + $returnType = ''; + $request = $this->deleteContactRequest($email); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/attributes/{attributeCategory}/{attributeName}' + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + 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 deleteContactAsync + * + * Deletes a contact + * + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteContactAsync($email) + { + return $this->deleteContactAsyncWithHttpInfo($email) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteContactAsyncWithHttpInfo + * + * Deletes a contact + * + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteContactAsyncWithHttpInfo($email) + { + $returnType = ''; + $request = $this->deleteContactRequest($email); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteContact' + * + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteContactRequest($email) + { + // verify the required parameter 'email' is set + if ($email === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $email when calling deleteContact' ); + } + + $resourcePath = '/contacts/{email}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($email !== null) { + $resourcePath = str_replace( + '{' . 'email' . '}', + ObjectSerializer::toPathValue($email), + $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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteFolder + * + * Delete a folder (and all its lists) + * + * @param int $folderId Id of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteFolder($folderId) + { + $this->deleteFolderWithHttpInfo($folderId); + } + + /** + * Operation deleteFolderWithHttpInfo + * + * Delete a folder (and all its lists) + * + * @param int $folderId Id of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteFolderWithHttpInfo($folderId) + { + $returnType = ''; + $request = $this->deleteFolderRequest($folderId); + + 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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteContact + * Operation deleteFolderAsync * - * Deletes a contact + * Delete a folder (and all its lists) * - * @param string $email Email (urlencoded) of the contact (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $folderId Id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteContact($email) + public function deleteFolderAsync($folderId) { - list($response) = $this->deleteContactWithHttpInfo($email); - return $response; + return $this->deleteFolderAsyncWithHttpInfo($folderId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteContactWithHttpInfo + * Operation deleteFolderAsyncWithHttpInfo * - * Deletes a contact + * Delete a folder (and all its lists) * - * @param string $email Email (urlencoded) of the contact (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $folderId Id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteContactWithHttpInfo($email) + public function deleteFolderAsyncWithHttpInfo($folderId) { - // verify the required parameter 'email' is set - if ($email === null) { - throw new \InvalidArgumentException('Missing the required parameter $email when calling deleteContact'); + $returnType = ''; + $request = $this->deleteFolderRequest($folderId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteFolder' + * + * @param int $folderId Id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteFolderRequest($folderId) + { + // verify the required parameter 'folderId' is set + if ($folderId === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling deleteFolder' + ); } - // parse inputs - $resourcePath = "/contacts/{email}"; - $httpBody = ''; + + $resourcePath = '/contacts/folders/{folderId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params - if ($email !== null) { + if ($folderId !== null) { $resourcePath = str_replace( - "{" . "email" . "}", - $this->apiClient->getSerializer()->toPathValue($email), + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/{email}' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** - * Operation deleteFolder + * Operation deleteList * - * Delete a folder (and all its lists) + * Delete a list + * + * @param int $listId Id of the list (required) * - * @param int $folderId Id of the folder (required) * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ - public function deleteFolder($folderId) + public function deleteList($listId) { - list($response) = $this->deleteFolderWithHttpInfo($folderId); - return $response; + $this->deleteListWithHttpInfo($listId); } /** - * Operation deleteFolderWithHttpInfo + * Operation deleteListWithHttpInfo * - * Delete a folder (and all its lists) + * Delete a list + * + * @param int $listId Id of the list (required) * - * @param int $folderId Id of the folder (required) * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteFolderWithHttpInfo($folderId) + public function deleteListWithHttpInfo($listId) { - // verify the required parameter 'folderId' is set - if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling deleteFolder'); - } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); - - // path params - if ($folderId !== null) { - $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), - $resourcePath - ); - } + $returnType = ''; + $request = $this->deleteListRequest($listId); - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/folders/{folderId}' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteList + * Operation deleteListAsync * * Delete a list * - * @param int $listId Id of the list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteList($listId) + public function deleteListAsync($listId) { - list($response) = $this->deleteListWithHttpInfo($listId); - return $response; + return $this->deleteListAsyncWithHttpInfo($listId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteListWithHttpInfo + * Operation deleteListAsyncWithHttpInfo * * Delete a list * - * @param int $listId Id of the list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteListWithHttpInfo($listId) + public function deleteListAsyncWithHttpInfo($listId) + { + $returnType = ''; + $request = $this->deleteListRequest($listId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteList' + * + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteListRequest($listId) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling deleteList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling deleteList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/lists/{listId}' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -952,7 +2468,9 @@ public function deleteListWithHttpInfo($listId) * * Lists all attributes * + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetAttributes */ public function getAttributes() @@ -966,1002 +2484,3036 @@ public function getAttributes() * * Lists all attributes * + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetAttributes, HTTP status code, HTTP response headers (array of strings) */ public function getAttributesWithHttpInfo() { - // parse inputs - $resourcePath = "/contacts/attributes"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\GetAttributes'; + $request = $this->getAttributesRequest(); + + 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\GetAttributes', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAttributesAsync + * + * Lists all attributes + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttributesAsync() + { + return $this->getAttributesAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAttributesAsyncWithHttpInfo + * + * Lists all attributes + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAttributesAsyncWithHttpInfo() + { + $returnType = '\SendinBlue\Client\Model\GetAttributes'; + $request = $this->getAttributesRequest(); + + 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 'getAttributes' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getAttributesRequest() + { + + $resourcePath = '/contacts/attributes'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getContactInfo + * + * Retrieves contact informations + * + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetExtendedContactDetails + */ + public function getContactInfo($email) + { + list($response) = $this->getContactInfoWithHttpInfo($email); + return $response; + } + + /** + * Operation getContactInfoWithHttpInfo + * + * Retrieves contact informations + * + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetExtendedContactDetails, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactInfoWithHttpInfo($email) + { + $returnType = '\SendinBlue\Client\Model\GetExtendedContactDetails'; + $request = $this->getContactInfoRequest($email); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetAttributes', - '/contacts/attributes' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetAttributes', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetAttributes', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetExtendedContactDetails', + $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 getContactInfo + * Operation getContactInfoAsync * * Retrieves contact informations * - * @param string $email Email (urlencoded) of the contact (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetExtendedContactDetails + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactInfo($email) + public function getContactInfoAsync($email) { - list($response) = $this->getContactInfoWithHttpInfo($email); - return $response; + return $this->getContactInfoAsyncWithHttpInfo($email) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getContactInfoWithHttpInfo + * Operation getContactInfoAsyncWithHttpInfo * * Retrieves contact informations * - * @param string $email Email (urlencoded) of the contact (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetExtendedContactDetails, HTTP status code, HTTP response headers (array of strings) + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactInfoWithHttpInfo($email) + public function getContactInfoAsyncWithHttpInfo($email) + { + $returnType = '\SendinBlue\Client\Model\GetExtendedContactDetails'; + $request = $this->getContactInfoRequest($email); + + 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 'getContactInfo' + * + * @param string $email Email (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getContactInfoRequest($email) { // verify the required parameter 'email' is set if ($email === null) { - throw new \InvalidArgumentException('Missing the required parameter $email when calling getContactInfo'); + throw new \InvalidArgumentException( + 'Missing the required parameter $email when calling getContactInfo' + ); } - // parse inputs - $resourcePath = "/contacts/{email}"; - $httpBody = ''; + + $resourcePath = '/contacts/{email}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($email !== null) { $resourcePath = str_replace( - "{" . "email" . "}", - $this->apiClient->getSerializer()->toPathValue($email), + '{' . 'email' . '}', + ObjectSerializer::toPathValue($email), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 getContactStats + * + * Get the campaigns statistics for a contact + * + * @param string $email Email address (urlencoded) of the contact (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetContactCampaignStats + */ + public function getContactStats($email) + { + list($response) = $this->getContactStatsWithHttpInfo($email); + return $response; + } + + /** + * Operation getContactStatsWithHttpInfo + * + * Get the campaigns statistics for a contact + * + * @param string $email Email address (urlencoded) of the contact (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetContactCampaignStats, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactStatsWithHttpInfo($email) + { + $returnType = '\SendinBlue\Client\Model\GetContactCampaignStats'; + $request = $this->getContactStatsRequest($email); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetExtendedContactDetails', - '/contacts/{email}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetExtendedContactDetails', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetExtendedContactDetails', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetContactCampaignStats', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getContactStats + * Operation getContactStatsAsync * * Get the campaigns statistics for a contact * - * @param string $email Email address (urlencoded) of the contact (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetContactCampaignStats + * @param string $email Email address (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactStats($email) + public function getContactStatsAsync($email) { - list($response) = $this->getContactStatsWithHttpInfo($email); - return $response; + return $this->getContactStatsAsyncWithHttpInfo($email) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getContactStatsWithHttpInfo + * Operation getContactStatsAsyncWithHttpInfo * * Get the campaigns statistics for a contact * - * @param string $email Email address (urlencoded) of the contact (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetContactCampaignStats, HTTP status code, HTTP response headers (array of strings) + * @param string $email Email address (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactStatsWithHttpInfo($email) + public function getContactStatsAsyncWithHttpInfo($email) + { + $returnType = '\SendinBlue\Client\Model\GetContactCampaignStats'; + $request = $this->getContactStatsRequest($email); + + 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 'getContactStats' + * + * @param string $email Email address (urlencoded) of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getContactStatsRequest($email) { // verify the required parameter 'email' is set if ($email === null) { - throw new \InvalidArgumentException('Missing the required parameter $email when calling getContactStats'); + throw new \InvalidArgumentException( + 'Missing the required parameter $email when calling getContactStats' + ); } - // parse inputs - $resourcePath = "/contacts/{email}/campaignStats"; - $httpBody = ''; + + $resourcePath = '/contacts/{email}/campaignStats'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($email !== null) { $resourcePath = str_replace( - "{" . "email" . "}", - $this->apiClient->getSerializer()->toPathValue($email), + '{' . 'email' . '}', + ObjectSerializer::toPathValue($email), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 getContacts + * + * Get all the contacts + * + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetContacts + */ + public function getContacts($limit = '50', $offset = '0', $modifiedSince = null) + { + list($response) = $this->getContactsWithHttpInfo($limit, $offset, $modifiedSince); + return $response; + } + + /** + * Operation getContactsWithHttpInfo + * + * Get all the contacts + * + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedSince = null) + { + $returnType = '\SendinBlue\Client\Model\GetContacts'; + $request = $this->getContactsRequest($limit, $offset, $modifiedSince); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetContactCampaignStats', - '/contacts/{email}/campaignStats' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetContactCampaignStats', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetContactCampaignStats', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetContacts', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getContacts + * Operation getContactsAsync * * Get all the contacts * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetContacts + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContacts($limit = '50', $offset = '0', $modifiedSince = null) + public function getContactsAsync($limit = '50', $offset = '0', $modifiedSince = null) { - list($response) = $this->getContactsWithHttpInfo($limit, $offset, $modifiedSince); - return $response; + return $this->getContactsAsyncWithHttpInfo($limit, $offset, $modifiedSince) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getContactsWithHttpInfo + * Operation getContactsAsyncWithHttpInfo * * Get all the contacts * - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactsWithHttpInfo($limit = '50', $offset = '0', $modifiedSince = null) + public function getContactsAsyncWithHttpInfo($limit = '50', $offset = '0', $modifiedSince = null) + { + $returnType = '\SendinBlue\Client\Model\GetContacts'; + $request = $this->getContactsRequest($limit, $offset, $modifiedSince); + + 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 'getContacts' + * + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getContactsRequest($limit = '50', $offset = '0', $modifiedSince = null) { - if (!is_null($limit) && ($limit > 1000)) { + if ($limit !== null && $limit > 1000) { throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContacts, must be smaller than or equal to 1000.'); } - // parse inputs - $resourcePath = "/contacts"; - $httpBody = ''; + + $resourcePath = '/contacts'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } // query params if ($modifiedSince !== null) { - $queryParams['modifiedSince'] = $this->apiClient->getSerializer()->toQueryValue($modifiedSince); + $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getContactsFromList + * + * Get the contacts in a list + * + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetContacts + */ + public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0') + { + list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset); + return $response; + } + + /** + * Operation getContactsFromListWithHttpInfo + * + * Get the contacts in a list + * + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetContacts'; + $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetContacts', - '/contacts' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetContacts', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetContacts', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetContacts', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $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 getContactsFromList + * Operation getContactsFromListAsync * * Get the contacts in a list * - * @param int $listId Id of the list (required) - * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetContacts + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0') + public function getContactsFromListAsync($listId, $modifiedSince = null, $limit = '50', $offset = '0') { - list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset); - return $response; + return $this->getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getContactsFromListWithHttpInfo + * Operation getContactsFromListAsyncWithHttpInfo * * Get the contacts in a list * - * @param int $listId Id of the list (required) - * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0') + public function getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetContacts'; + $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset); + + 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 'getContactsFromList' + * + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getContactsFromListRequest($listId, $modifiedSince = null, $limit = '50', $offset = '0') { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling getContactsFromList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling getContactsFromList' + ); } - if (!is_null($limit) && ($limit > 500)) { + if ($limit !== null && $limit > 500) { throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getContactsFromList, must be smaller than or equal to 500.'); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}/contacts"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}/contacts'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($modifiedSince !== null) { - $queryParams['modifiedSince'] = $this->apiClient->getSerializer()->toQueryValue($modifiedSince); + $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince); } // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getFolder + * + * Returns folder details + * + * @param int $folderId id of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetFolder + */ + public function getFolder($folderId) + { + list($response) = $this->getFolderWithHttpInfo($folderId); + return $response; + } + + /** + * Operation getFolderWithHttpInfo + * + * Returns folder details + * + * @param int $folderId id of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetFolder, HTTP status code, HTTP response headers (array of strings) + */ + public function getFolderWithHttpInfo($folderId) + { + $returnType = '\SendinBlue\Client\Model\GetFolder'; + $request = $this->getFolderRequest($folderId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetContacts', - '/contacts/lists/{listId}/contacts' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetContacts', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetContacts', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetFolder', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getFolder + * Operation getFolderAsync * * Returns folder details * - * @param int $folderId id of the folder (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetFolder + * @param int $folderId id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFolder($folderId) + public function getFolderAsync($folderId) { - list($response) = $this->getFolderWithHttpInfo($folderId); - return $response; + return $this->getFolderAsyncWithHttpInfo($folderId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getFolderWithHttpInfo + * Operation getFolderAsyncWithHttpInfo * * Returns folder details * - * @param int $folderId id of the folder (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetFolder, HTTP status code, HTTP response headers (array of strings) + * @param int $folderId id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFolderWithHttpInfo($folderId) + public function getFolderAsyncWithHttpInfo($folderId) + { + $returnType = '\SendinBlue\Client\Model\GetFolder'; + $request = $this->getFolderRequest($folderId); + + 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 'getFolder' + * + * @param int $folderId id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getFolderRequest($folderId) { // verify the required parameter 'folderId' is set if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling getFolder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling getFolder' + ); } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}"; - $httpBody = ''; + + $resourcePath = '/contacts/folders/{folderId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($folderId !== null) { $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getFolderLists + * + * Get the lists in a folder + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetFolderLists + */ + public function getFolderLists($folderId, $limit = '10', $offset = '0') + { + list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset); + return $response; + } + + /** + * Operation getFolderListsWithHttpInfo + * + * Get the lists in a folder + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings) + */ + public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetFolderLists'; + $request = $this->getFolderListsRequest($folderId, $limit, $offset); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetFolder', - '/contacts/folders/{folderId}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolder', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolder', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetFolderLists', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getFolderLists + * Operation getFolderListsAsync * * Get the lists in a folder * - * @param int $folderId Id of the folder (required) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetFolderLists + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFolderLists($folderId, $limit = '10', $offset = '0') + public function getFolderListsAsync($folderId, $limit = '10', $offset = '0') { - list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset); - return $response; + return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getFolderListsWithHttpInfo + * Operation getFolderListsAsyncWithHttpInfo * * Get the lists in a folder * - * @param int $folderId Id of the folder (required) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings) + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0') + public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetFolderLists'; + $request = $this->getFolderListsRequest($folderId, $limit, $offset); + + 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 'getFolderLists' + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0') { // verify the required parameter 'folderId' is set if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling getFolderLists'); + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling getFolderLists' + ); } - if (!is_null($limit) && ($limit > 50)) { + if ($limit !== null && $limit > 50) { throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolderLists, must be smaller than or equal to 50.'); } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}/lists"; - $httpBody = ''; + + $resourcePath = '/contacts/folders/{folderId}/lists'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } + // path params if ($folderId !== null) { $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getFolders + * + * Get all the folders + * + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetFolders + */ + public function getFolders($limit, $offset) + { + list($response) = $this->getFoldersWithHttpInfo($limit, $offset); + return $response; + } + + /** + * Operation getFoldersWithHttpInfo + * + * Get all the folders + * + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetFolders, HTTP status code, HTTP response headers (array of strings) + */ + public function getFoldersWithHttpInfo($limit, $offset) + { + $returnType = '\SendinBlue\Client\Model\GetFolders'; + $request = $this->getFoldersRequest($limit, $offset); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetFolderLists', - '/contacts/folders/{folderId}/lists' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolderLists', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolderLists', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetFolders', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getFolders + * Operation getFoldersAsync + * + * Get all the folders + * + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFoldersAsync($limit, $offset) + { + return $this->getFoldersAsyncWithHttpInfo($limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getFoldersAsyncWithHttpInfo * * Get all the folders * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetFolders + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFolders($limit, $offset) + public function getFoldersAsyncWithHttpInfo($limit, $offset) { - list($response) = $this->getFoldersWithHttpInfo($limit, $offset); - return $response; + $returnType = '\SendinBlue\Client\Model\GetFolders'; + $request = $this->getFoldersRequest($limit, $offset); + + 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() + ); + } + ); } /** - * Operation getFoldersWithHttpInfo + * Create request for operation 'getFolders' * - * Get all the folders + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetFolders, HTTP status code, HTTP response headers (array of strings) + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request */ - public function getFoldersWithHttpInfo($limit, $offset) + protected function getFoldersRequest($limit, $offset) { // verify the required parameter 'limit' is set if ($limit === null) { - throw new \InvalidArgumentException('Missing the required parameter $limit when calling getFolders'); + throw new \InvalidArgumentException( + 'Missing the required parameter $limit when calling getFolders' + ); } - if (($limit > 50)) { + if ($limit > 50) { throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getFolders, must be smaller than or equal to 50.'); } // verify the required parameter 'offset' is set if ($offset === null) { - throw new \InvalidArgumentException('Missing the required parameter $offset when calling getFolders'); + throw new \InvalidArgumentException( + 'Missing the required parameter $offset when calling getFolders' + ); } - // parse inputs - $resourcePath = "/contacts/folders"; - $httpBody = ''; + + $resourcePath = '/contacts/folders'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getList + * + * Get the details of a list + * + * @param int $listId Id of the list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetExtendedList + */ + public function getList($listId) + { + list($response) = $this->getListWithHttpInfo($listId); + return $response; + } + + /** + * Operation getListWithHttpInfo + * + * Get the details of a list + * + * @param int $listId Id of the list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings) + */ + public function getListWithHttpInfo($listId) + { + $returnType = '\SendinBlue\Client\Model\GetExtendedList'; + $request = $this->getListRequest($listId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetFolders', - '/contacts/folders' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolders', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolders', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetExtendedList', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $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 getList + * Operation getListAsync * * Get the details of a list * - * @param int $listId Id of the list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetExtendedList + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getList($listId) + public function getListAsync($listId) { - list($response) = $this->getListWithHttpInfo($listId); - return $response; + return $this->getListAsyncWithHttpInfo($listId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getListWithHttpInfo + * Operation getListAsyncWithHttpInfo * * Get the details of a list * - * @param int $listId Id of the list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings) + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getListWithHttpInfo($listId) + public function getListAsyncWithHttpInfo($listId) + { + $returnType = '\SendinBlue\Client\Model\GetExtendedList'; + $request = $this->getListRequest($listId); + + 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 'getList' + * + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getListRequest($listId) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling getList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling getList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getLists + * + * Get all the lists + * + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetLists + */ + public function getLists($limit = '10', $offset = '0') + { + list($response) = $this->getListsWithHttpInfo($limit, $offset); + return $response; + } + + /** + * Operation getListsWithHttpInfo + * + * Get all the lists + * + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings) + */ + public function getListsWithHttpInfo($limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetLists'; + $request = $this->getListsRequest($limit, $offset); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetExtendedList', - '/contacts/lists/{listId}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetExtendedList', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetExtendedList', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetLists', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getLists + * Operation getListsAsync * * Get all the lists * - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetLists + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getLists($limit = '10', $offset = '0') + public function getListsAsync($limit = '10', $offset = '0') { - list($response) = $this->getListsWithHttpInfo($limit, $offset); - return $response; + return $this->getListsAsyncWithHttpInfo($limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getListsWithHttpInfo + * Operation getListsAsyncWithHttpInfo * * Get all the lists * - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getListsWithHttpInfo($limit = '10', $offset = '0') + public function getListsAsyncWithHttpInfo($limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetLists'; + $request = $this->getListsRequest($limit, $offset); + + 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 'getLists' + * + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getListsRequest($limit = '10', $offset = '0') { - if (!is_null($limit) && ($limit > 50)) { + if ($limit !== null && $limit > 50) { throw new \InvalidArgumentException('invalid value for "$limit" when calling ContactsApi.getLists, must be smaller than or equal to 50.'); } - // parse inputs - $resourcePath = "/contacts/lists"; - $httpBody = ''; + + $resourcePath = '/contacts/lists'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 importContacts + * + * Import contacts + * + * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\CreatedProcessId + */ + public function importContacts($requestContactImport) + { + list($response) = $this->importContactsWithHttpInfo($requestContactImport); + return $response; + } + + /** + * Operation importContactsWithHttpInfo + * + * Import contacts + * + * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + */ + public function importContactsWithHttpInfo($requestContactImport) + { + $returnType = '\SendinBlue\Client\Model\CreatedProcessId'; + $request = $this->importContactsRequest($requestContactImport); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetLists', - '/contacts/lists' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetLists', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetLists', $e->getResponseHeaders()); + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreatedProcessId', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation importContacts + * Operation importContactsAsync * * Import contacts * - * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\CreatedProcessId + * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function importContacts($requestContactImport) + public function importContactsAsync($requestContactImport) { - list($response) = $this->importContactsWithHttpInfo($requestContactImport); - return $response; + return $this->importContactsAsyncWithHttpInfo($requestContactImport) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation importContactsAsyncWithHttpInfo + * + * Import contacts + * + * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function importContactsAsyncWithHttpInfo($requestContactImport) + { + $returnType = '\SendinBlue\Client\Model\CreatedProcessId'; + $request = $this->importContactsRequest($requestContactImport); + + 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() + ); + } + ); } /** - * Operation importContactsWithHttpInfo + * Create request for operation 'importContacts' * - * Import contacts + * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) * - * @param \SendinBlue\Client\Model\RequestContactImport $requestContactImport Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request */ - public function importContactsWithHttpInfo($requestContactImport) + protected function importContactsRequest($requestContactImport) { // verify the required parameter 'requestContactImport' is set if ($requestContactImport === null) { - throw new \InvalidArgumentException('Missing the required parameter $requestContactImport when calling importContacts'); + throw new \InvalidArgumentException( + 'Missing the required parameter $requestContactImport when calling importContacts' + ); } - // parse inputs - $resourcePath = "/contacts/import"; - $httpBody = ''; + + $resourcePath = '/contacts/import'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -1969,44 +5521,70 @@ public function importContactsWithHttpInfo($requestContactImport) $_tempBody = $requestContactImport; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreatedProcessId', - '/contacts/import' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreatedProcessId', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 202: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreatedProcessId', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -2014,9 +5592,11 @@ public function importContactsWithHttpInfo($requestContactImport) * * Remove existing contacts from a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\PostContactInfo */ public function removeContactFromList($listId, $contactEmails) @@ -2030,89 +5610,278 @@ public function removeContactFromList($listId, $contactEmails) * * Remove existing contacts from a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings) */ public function removeContactFromListWithHttpInfo($listId, $contactEmails) + { + $returnType = '\SendinBlue\Client\Model\PostContactInfo'; + $request = $this->removeContactFromListRequest($listId, $contactEmails); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\PostContactInfo', + $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 removeContactFromListAsync + * + * Remove existing contacts from a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function removeContactFromListAsync($listId, $contactEmails) + { + return $this->removeContactFromListAsyncWithHttpInfo($listId, $contactEmails) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation removeContactFromListAsyncWithHttpInfo + * + * Remove existing contacts from a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function removeContactFromListAsyncWithHttpInfo($listId, $contactEmails) + { + $returnType = '\SendinBlue\Client\Model\PostContactInfo'; + $request = $this->removeContactFromListRequest($listId, $contactEmails); + + 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 'removeContactFromList' + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function removeContactFromListRequest($listId, $contactEmails) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling removeContactFromList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling removeContactFromList' + ); } // verify the required parameter 'contactEmails' is set if ($contactEmails === null) { - throw new \InvalidArgumentException('Missing the required parameter $contactEmails when calling removeContactFromList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $contactEmails when calling removeContactFromList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}/contacts/remove"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}/contacts/remove'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $resourcePath ); } + // body params $_tempBody = null; if (isset($contactEmails)) { $_tempBody = $contactEmails; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\PostContactInfo', - '/contacts/lists/{listId}/contacts/remove' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\PostContactInfo', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostContactInfo', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -2120,8 +5889,10 @@ public function removeContactFromListWithHttpInfo($listId, $contactEmails) * * Export contacts * - * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreatedProcessId */ public function requestContactExport($requestContactExport) @@ -2135,27 +5906,181 @@ public function requestContactExport($requestContactExport) * * Export contacts * - * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) */ public function requestContactExportWithHttpInfo($requestContactExport) + { + $returnType = '\SendinBlue\Client\Model\CreatedProcessId'; + $request = $this->requestContactExportRequest($requestContactExport); + + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreatedProcessId', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation requestContactExportAsync + * + * Export contacts + * + * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function requestContactExportAsync($requestContactExport) + { + return $this->requestContactExportAsyncWithHttpInfo($requestContactExport) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation requestContactExportAsyncWithHttpInfo + * + * Export contacts + * + * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function requestContactExportAsyncWithHttpInfo($requestContactExport) + { + $returnType = '\SendinBlue\Client\Model\CreatedProcessId'; + $request = $this->requestContactExportRequest($requestContactExport); + + 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 'requestContactExport' + * + * @param \SendinBlue\Client\Model\RequestContactExport $requestContactExport Values to request a contact export (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function requestContactExportRequest($requestContactExport) { // verify the required parameter 'requestContactExport' is set if ($requestContactExport === null) { - throw new \InvalidArgumentException('Missing the required parameter $requestContactExport when calling requestContactExport'); + throw new \InvalidArgumentException( + 'Missing the required parameter $requestContactExport when calling requestContactExport' + ); } - // parse inputs - $resourcePath = "/contacts/export"; - $httpBody = ''; + + $resourcePath = '/contacts/export'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -2163,465 +6088,1147 @@ public function requestContactExportWithHttpInfo($requestContactExport) $_tempBody = $requestContactExport; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateAttribute + * + * Updates contact attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateAttribute($attributeCategory, $attributeName, $updateAttribute) + { + $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute); + } + + /** + * Operation updateAttributeWithHttpInfo + * + * Updates contact attribute + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + { + $returnType = ''; + $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreatedProcessId', - '/contacts/export' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreatedProcessId', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 202: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreatedProcessId', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateAttribute + * Operation updateAttributeAsync * * Updates contact attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAttribute($attributeCategory, $attributeName, $updateAttribute) + public function updateAttributeAsync($attributeCategory, $attributeName, $updateAttribute) { - list($response) = $this->updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute); - return $response; + return $this->updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateAttributeWithHttpInfo + * Operation updateAttributeAsyncWithHttpInfo * * Updates contact attribute * - * @param string $attributeCategory Category of the attribute (required) - * @param string $attributeName Name of the existing attribute (required) - * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAttributeWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + public function updateAttributeAsyncWithHttpInfo($attributeCategory, $attributeName, $updateAttribute) + { + $returnType = ''; + $request = $this->updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateAttribute' + * + * @param string $attributeCategory Category of the attribute (required) + * @param string $attributeName Name of the existing attribute (required) + * @param \SendinBlue\Client\Model\UpdateAttribute $updateAttribute Values to update an attribute (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateAttributeRequest($attributeCategory, $attributeName, $updateAttribute) { // verify the required parameter 'attributeCategory' is set if ($attributeCategory === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeCategory when calling updateAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeCategory when calling updateAttribute' + ); } // verify the required parameter 'attributeName' is set if ($attributeName === null) { - throw new \InvalidArgumentException('Missing the required parameter $attributeName when calling updateAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $attributeName when calling updateAttribute' + ); } // verify the required parameter 'updateAttribute' is set if ($updateAttribute === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateAttribute when calling updateAttribute'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateAttribute when calling updateAttribute' + ); } - // parse inputs - $resourcePath = "/contacts/attributes/{attributeCategory}/{attributeName}"; - $httpBody = ''; + + $resourcePath = '/contacts/attributes/{attributeCategory}/{attributeName}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($attributeCategory !== null) { $resourcePath = str_replace( - "{" . "attributeCategory" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeCategory), + '{' . 'attributeCategory' . '}', + ObjectSerializer::toPathValue($attributeCategory), $resourcePath ); } // path params if ($attributeName !== null) { $resourcePath = str_replace( - "{" . "attributeName" . "}", - $this->apiClient->getSerializer()->toPathValue($attributeName), + '{' . 'attributeName' . '}', + ObjectSerializer::toPathValue($attributeName), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateAttribute)) { $_tempBody = $updateAttribute; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateContact + * + * Updates a contact + * + * @param string $email Email (urlencoded) of the contact (required) + * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateContact($email, $updateContact) + { + $this->updateContactWithHttpInfo($email, $updateContact); + } + + /** + * Operation updateContactWithHttpInfo + * + * Updates a contact + * + * @param string $email Email (urlencoded) of the contact (required) + * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateContactWithHttpInfo($email, $updateContact) + { + $returnType = ''; + $request = $this->updateContactRequest($email, $updateContact); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/attributes/{attributeCategory}/{attributeName}' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateContact + * Operation updateContactAsync * * Updates a contact * - * @param string $email Email (urlencoded) of the contact (required) - * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param string $email Email (urlencoded) of the contact (required) + * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateContact($email, $updateContact) + public function updateContactAsync($email, $updateContact) { - list($response) = $this->updateContactWithHttpInfo($email, $updateContact); - return $response; + return $this->updateContactAsyncWithHttpInfo($email, $updateContact) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateContactWithHttpInfo + * Operation updateContactAsyncWithHttpInfo * * Updates a contact * - * @param string $email Email (urlencoded) of the contact (required) - * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param string $email Email (urlencoded) of the contact (required) + * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateContactWithHttpInfo($email, $updateContact) + public function updateContactAsyncWithHttpInfo($email, $updateContact) + { + $returnType = ''; + $request = $this->updateContactRequest($email, $updateContact); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateContact' + * + * @param string $email Email (urlencoded) of the contact (required) + * @param \SendinBlue\Client\Model\UpdateContact $updateContact Values to update a contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateContactRequest($email, $updateContact) { // verify the required parameter 'email' is set if ($email === null) { - throw new \InvalidArgumentException('Missing the required parameter $email when calling updateContact'); + throw new \InvalidArgumentException( + 'Missing the required parameter $email when calling updateContact' + ); } // verify the required parameter 'updateContact' is set if ($updateContact === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateContact when calling updateContact'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateContact when calling updateContact' + ); } - // parse inputs - $resourcePath = "/contacts/{email}"; - $httpBody = ''; + + $resourcePath = '/contacts/{email}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($email !== null) { $resourcePath = str_replace( - "{" . "email" . "}", - $this->apiClient->getSerializer()->toPathValue($email), + '{' . 'email' . '}', + ObjectSerializer::toPathValue($email), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateContact)) { $_tempBody = $updateContact; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateFolder + * + * Update a contact folder + * + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateFolder($folderId, $updateFolder) + { + $this->updateFolderWithHttpInfo($folderId, $updateFolder); + } + + /** + * Operation updateFolderWithHttpInfo + * + * Update a contact folder + * + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateFolderWithHttpInfo($folderId, $updateFolder) + { + $returnType = ''; + $request = $this->updateFolderRequest($folderId, $updateFolder); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/{email}' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateFolder + * Operation updateFolderAsync * * Update a contact folder * - * @param int $folderId Id of the folder (required) - * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateFolder($folderId, $updateFolder) + public function updateFolderAsync($folderId, $updateFolder) { - list($response) = $this->updateFolderWithHttpInfo($folderId, $updateFolder); - return $response; + return $this->updateFolderAsyncWithHttpInfo($folderId, $updateFolder) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateFolderWithHttpInfo + * Operation updateFolderAsyncWithHttpInfo * * Update a contact folder * - * @param int $folderId Id of the folder (required) - * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateFolderWithHttpInfo($folderId, $updateFolder) + public function updateFolderAsyncWithHttpInfo($folderId, $updateFolder) + { + $returnType = ''; + $request = $this->updateFolderRequest($folderId, $updateFolder); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateFolder' + * + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateFolderRequest($folderId, $updateFolder) { // verify the required parameter 'folderId' is set if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling updateFolder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling updateFolder' + ); } // verify the required parameter 'updateFolder' is set if ($updateFolder === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateFolder when calling updateFolder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateFolder when calling updateFolder' + ); } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}"; - $httpBody = ''; + + $resourcePath = '/contacts/folders/{folderId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($folderId !== null) { $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateFolder)) { $_tempBody = $updateFolder; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateList + * + * Update a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateList($listId, $updateList) + { + $this->updateListWithHttpInfo($listId, $updateList); + } + + /** + * Operation updateListWithHttpInfo + * + * Update a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateListWithHttpInfo($listId, $updateList) + { + $returnType = ''; + $request = $this->updateListRequest($listId, $updateList); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/folders/{folderId}' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateList + * Operation updateListAsync * * Update a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateList($listId, $updateList) + public function updateListAsync($listId, $updateList) { - list($response) = $this->updateListWithHttpInfo($listId, $updateList); - return $response; + return $this->updateListAsyncWithHttpInfo($listId, $updateList) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateListWithHttpInfo + * Operation updateListAsyncWithHttpInfo * * Update a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateListWithHttpInfo($listId, $updateList) + public function updateListAsyncWithHttpInfo($listId, $updateList) + { + $returnType = ''; + $request = $this->updateListRequest($listId, $updateList); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateList' + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateListRequest($listId, $updateList) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling updateList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling updateList' + ); } // verify the required parameter 'updateList' is set if ($updateList === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateList when calling updateList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateList when calling updateList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateList)) { $_tempBody = $updateList; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/lists/{listId}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/EmailCampaignsApi.php b/lib/Api/EmailCampaignsApi.php index be50d316..3dcbb6e1 100644 --- a/lib/Api/EmailCampaignsApi.php +++ b/lib/Api/EmailCampaignsApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * EmailCampaignsApi Class Doc Comment @@ -44,47 +50,36 @@ class EmailCampaignsApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return EmailCampaignsApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,8 +87,10 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Create an email campaign * - * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateModel */ public function createEmailCampaign($emailCampaigns) @@ -107,27 +104,181 @@ public function createEmailCampaign($emailCampaigns) * * Create an email campaign * - * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) */ public function createEmailCampaignWithHttpInfo($emailCampaigns) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createEmailCampaignRequest($emailCampaigns); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createEmailCampaignAsync + * + * Create an email campaign + * + * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEmailCampaignAsync($emailCampaigns) + { + return $this->createEmailCampaignAsyncWithHttpInfo($emailCampaigns) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEmailCampaignAsyncWithHttpInfo + * + * Create an email campaign + * + * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createEmailCampaignAsyncWithHttpInfo($emailCampaigns) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createEmailCampaignRequest($emailCampaigns); + + 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 'createEmailCampaign' + * + * @param \SendinBlue\Client\Model\CreateEmailCampaign $emailCampaigns Values to create a campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createEmailCampaignRequest($emailCampaigns) { // verify the required parameter 'emailCampaigns' is set if ($emailCampaigns === null) { - throw new \InvalidArgumentException('Missing the required parameter $emailCampaigns when calling createEmailCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $emailCampaigns when calling createEmailCampaign' + ); } - // parse inputs - $resourcePath = "/emailCampaigns"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -135,237 +286,607 @@ public function createEmailCampaignWithHttpInfo($emailCampaigns) $_tempBody = $emailCampaigns; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteEmailCampaign + * + * Delete an email campaign + * + * @param int $campaignId id of the campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteEmailCampaign($campaignId) + { + $this->deleteEmailCampaignWithHttpInfo($campaignId); + } + + /** + * Operation deleteEmailCampaignWithHttpInfo + * + * Delete an email campaign + * + * @param int $campaignId id of the campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteEmailCampaignWithHttpInfo($campaignId) + { + $returnType = ''; + $request = $this->deleteEmailCampaignRequest($campaignId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/emailCampaigns' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteEmailCampaign + * Operation deleteEmailCampaignAsync * * Delete an email campaign * - * @param int $campaignId id of the campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteEmailCampaign($campaignId) + public function deleteEmailCampaignAsync($campaignId) { - list($response) = $this->deleteEmailCampaignWithHttpInfo($campaignId); - return $response; + return $this->deleteEmailCampaignAsyncWithHttpInfo($campaignId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteEmailCampaignWithHttpInfo + * Operation deleteEmailCampaignAsyncWithHttpInfo * * Delete an email campaign * - * @param int $campaignId id of the campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteEmailCampaignWithHttpInfo($campaignId) + public function deleteEmailCampaignAsyncWithHttpInfo($campaignId) + { + $returnType = ''; + $request = $this->deleteEmailCampaignRequest($campaignId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteEmailCampaign' + * + * @param int $campaignId id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteEmailCampaignRequest($campaignId) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling deleteEmailCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling deleteEmailCampaign' + ); } - // parse inputs - $resourcePath = "/emailCampaigns/{campaignId}"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns/{campaignId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . '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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation emailExportRecipients + * + * Export the recipients of a campaign + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\CreatedProcessId + */ + public function emailExportRecipients($campaignId, $recipientExport = null) + { + list($response) = $this->emailExportRecipientsWithHttpInfo($campaignId, $recipientExport); + return $response; + } + + /** + * Operation emailExportRecipientsWithHttpInfo + * + * Export the recipients of a campaign + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + */ + public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport = null) + { + $returnType = '\SendinBlue\Client\Model\CreatedProcessId'; + $request = $this->emailExportRecipientsRequest($campaignId, $recipientExport); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/emailCampaigns/{campaignId}' - ); + $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() + ]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreatedProcessId', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation emailExportRecipients + * Operation emailExportRecipientsAsync * * Export the recipients of a campaign * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\CreatedProcessId + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function emailExportRecipients($campaignId, $recipientExport = null) + public function emailExportRecipientsAsync($campaignId, $recipientExport = null) { - list($response) = $this->emailExportRecipientsWithHttpInfo($campaignId, $recipientExport); - return $response; + return $this->emailExportRecipientsAsyncWithHttpInfo($campaignId, $recipientExport) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation emailExportRecipientsWithHttpInfo + * Operation emailExportRecipientsAsyncWithHttpInfo * * Export the recipients of a campaign * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport = null) + public function emailExportRecipientsAsyncWithHttpInfo($campaignId, $recipientExport = null) + { + $returnType = '\SendinBlue\Client\Model\CreatedProcessId'; + $request = $this->emailExportRecipientsRequest($campaignId, $recipientExport); + + 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 'emailExportRecipients' + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\EmailExportRecipients $recipientExport Values to send for a recipient export request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function emailExportRecipientsRequest($campaignId, $recipientExport = null) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling emailExportRecipients'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling emailExportRecipients' + ); } - // parse inputs - $resourcePath = "/emailCampaigns/{campaignId}/exportRecipients"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns/{campaignId}/exportRecipients'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($recipientExport)) { $_tempBody = $recipientExport; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreatedProcessId', - '/emailCampaigns/{campaignId}/exportRecipients' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreatedProcessId', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 202: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreatedProcessId', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -373,8 +894,10 @@ public function emailExportRecipientsWithHttpInfo($campaignId, $recipientExport * * Get campaign informations * - * @param int $campaignId Id of the campaign (required) + * @param int $campaignId Id of the campaign (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetEmailCampaign */ public function getEmailCampaign($campaignId) @@ -388,686 +911,1873 @@ public function getEmailCampaign($campaignId) * * Get campaign informations * - * @param int $campaignId Id of the campaign (required) + * @param int $campaignId Id of the campaign (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetEmailCampaign, HTTP status code, HTTP response headers (array of strings) */ public function getEmailCampaignWithHttpInfo($campaignId) + { + $returnType = '\SendinBlue\Client\Model\GetEmailCampaign'; + $request = $this->getEmailCampaignRequest($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\GetEmailCampaign', + $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 getEmailCampaignAsync + * + * Get campaign informations + * + * @param int $campaignId Id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailCampaignAsync($campaignId) + { + return $this->getEmailCampaignAsyncWithHttpInfo($campaignId) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEmailCampaignAsyncWithHttpInfo + * + * Get campaign informations + * + * @param int $campaignId Id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getEmailCampaignAsyncWithHttpInfo($campaignId) + { + $returnType = '\SendinBlue\Client\Model\GetEmailCampaign'; + $request = $this->getEmailCampaignRequest($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 'getEmailCampaign' + * + * @param int $campaignId Id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getEmailCampaignRequest($campaignId) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling getEmailCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getEmailCampaign' + ); } - // parse inputs - $resourcePath = "/emailCampaigns/{campaignId}"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns/{campaignId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . '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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 getEmailCampaigns + * + * Return all your created campaigns + * + * @param string $type Filter on the type of the campaigns (optional) + * @param string $status Filter on the status of the campaign (optional) + * @param int $limit Number of documents per page (optional, default to 500) + * @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\GetEmailCampaigns + */ + public function getEmailCampaigns($type = null, $status = null, $limit = '500', $offset = '0') + { + list($response) = $this->getEmailCampaignsWithHttpInfo($type, $status, $limit, $offset); + return $response; + } + + /** + * Operation getEmailCampaignsWithHttpInfo + * + * Return all your created campaigns + * + * @param string $type Filter on the type of the campaigns (optional) + * @param string $status Filter on the status of the campaign (optional) + * @param int $limit Number of documents per page (optional, default to 500) + * @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\GetEmailCampaigns, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailCampaignsWithHttpInfo($type = null, $status = null, $limit = '500', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetEmailCampaigns'; + $request = $this->getEmailCampaignsRequest($type, $status, $limit, $offset); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetEmailCampaign', - '/emailCampaigns/{campaignId}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetEmailCampaign', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetEmailCampaign', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetEmailCampaigns', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getEmailCampaigns + * Operation getEmailCampaignsAsync * * Return all your created campaigns * - * @param string $type Filter on the type of the campaigns (optional) - * @param string $status Filter on the status of the campaign (optional) - * @param int $limit Number of documents per page (optional, default to 500) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetEmailCampaigns + * @param string $type Filter on the type of the campaigns (optional) + * @param string $status Filter on the status of the campaign (optional) + * @param int $limit Number of documents per page (optional, default to 500) + * @param int $offset Index of the first document in the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getEmailCampaigns($type = null, $status = null, $limit = '500', $offset = '0') + public function getEmailCampaignsAsync($type = null, $status = null, $limit = '500', $offset = '0') { - list($response) = $this->getEmailCampaignsWithHttpInfo($type, $status, $limit, $offset); - return $response; + return $this->getEmailCampaignsAsyncWithHttpInfo($type, $status, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getEmailCampaignsWithHttpInfo + * Operation getEmailCampaignsAsyncWithHttpInfo * * Return all your created campaigns * - * @param string $type Filter on the type of the campaigns (optional) - * @param string $status Filter on the status of the campaign (optional) - * @param int $limit Number of documents per page (optional, default to 500) - * @param int $offset Index of the first document in the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetEmailCampaigns, HTTP status code, HTTP response headers (array of strings) + * @param string $type Filter on the type of the campaigns (optional) + * @param string $status Filter on the status of the campaign (optional) + * @param int $limit Number of documents per page (optional, default to 500) + * @param int $offset Index of the first document in the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getEmailCampaignsWithHttpInfo($type = null, $status = null, $limit = '500', $offset = '0') + public function getEmailCampaignsAsyncWithHttpInfo($type = null, $status = null, $limit = '500', $offset = '0') { - if (!is_null($limit) && ($limit > 1000)) { + $returnType = '\SendinBlue\Client\Model\GetEmailCampaigns'; + $request = $this->getEmailCampaignsRequest($type, $status, $limit, $offset); + + 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 'getEmailCampaigns' + * + * @param string $type Filter on the type of the campaigns (optional) + * @param string $status Filter on the status of the campaign (optional) + * @param int $limit Number of documents per page (optional, default to 500) + * @param int $offset Index of the first document in the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getEmailCampaignsRequest($type = null, $status = null, $limit = '500', $offset = '0') + { + if ($limit !== null && $limit > 1000) { throw new \InvalidArgumentException('invalid value for "$limit" when calling EmailCampaignsApi.getEmailCampaigns, must be smaller than or equal to 1000.'); } - // parse inputs - $resourcePath = "/emailCampaigns"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($type !== null) { - $queryParams['type'] = $this->apiClient->getSerializer()->toQueryValue($type); + $queryParams['type'] = ObjectSerializer::toQueryValue($type); } // query params if ($status !== null) { - $queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status); + $queryParams['status'] = ObjectSerializer::toQueryValue($status); } // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 sendEmailCampaignNow + * + * Send an email campaign id of the campaign immediately + * + * @param int $campaignId Id of the campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendEmailCampaignNow($campaignId) + { + $this->sendEmailCampaignNowWithHttpInfo($campaignId); + } + + /** + * Operation sendEmailCampaignNowWithHttpInfo + * + * Send an email campaign id of the campaign immediately + * + * @param int $campaignId Id of the campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendEmailCampaignNowWithHttpInfo($campaignId) + { + $returnType = ''; + $request = $this->sendEmailCampaignNowRequest($campaignId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetEmailCampaigns', - '/emailCampaigns' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetEmailCampaigns', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetEmailCampaigns', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 402: + $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 sendEmailCampaignNow + * Operation sendEmailCampaignNowAsync * * Send an email campaign id of the campaign immediately * - * @param int $campaignId Id of the campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId Id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendEmailCampaignNow($campaignId) + public function sendEmailCampaignNowAsync($campaignId) { - list($response) = $this->sendEmailCampaignNowWithHttpInfo($campaignId); - return $response; + return $this->sendEmailCampaignNowAsyncWithHttpInfo($campaignId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation sendEmailCampaignNowWithHttpInfo + * Operation sendEmailCampaignNowAsyncWithHttpInfo * * Send an email campaign id of the campaign immediately * - * @param int $campaignId Id of the campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId Id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendEmailCampaignNowWithHttpInfo($campaignId) + public function sendEmailCampaignNowAsyncWithHttpInfo($campaignId) + { + $returnType = ''; + $request = $this->sendEmailCampaignNowRequest($campaignId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'sendEmailCampaignNow' + * + * @param int $campaignId Id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendEmailCampaignNowRequest($campaignId) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling sendEmailCampaignNow'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling sendEmailCampaignNow' + ); } - // parse inputs - $resourcePath = "/emailCampaigns/{campaignId}/sendNow"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns/{campaignId}/sendNow'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . '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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendReport + * + * Send the report of a campaigns + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendReport($campaignId, $sendReport) + { + $this->sendReportWithHttpInfo($campaignId, $sendReport); + } + + /** + * Operation sendReportWithHttpInfo + * + * Send the report of a campaigns + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendReportWithHttpInfo($campaignId, $sendReport) + { + $returnType = ''; + $request = $this->sendReportRequest($campaignId, $sendReport); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/emailCampaigns/{campaignId}/sendNow' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 402: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation sendReport + * Operation sendReportAsync * * Send the report of a campaigns * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendReport($campaignId, $sendReport) + public function sendReportAsync($campaignId, $sendReport) { - list($response) = $this->sendReportWithHttpInfo($campaignId, $sendReport); - return $response; + return $this->sendReportAsyncWithHttpInfo($campaignId, $sendReport) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation sendReportWithHttpInfo + * Operation sendReportAsyncWithHttpInfo * * Send the report of a campaigns * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendReportWithHttpInfo($campaignId, $sendReport) + public function sendReportAsyncWithHttpInfo($campaignId, $sendReport) + { + $returnType = ''; + $request = $this->sendReportRequest($campaignId, $sendReport); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'sendReport' + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendReportRequest($campaignId, $sendReport) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling sendReport'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling sendReport' + ); } // verify the required parameter 'sendReport' is set if ($sendReport === null) { - throw new \InvalidArgumentException('Missing the required parameter $sendReport when calling sendReport'); + throw new \InvalidArgumentException( + 'Missing the required parameter $sendReport when calling sendReport' + ); } - // parse inputs - $resourcePath = "/emailCampaigns/{campaignId}/sendReport"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns/{campaignId}/sendReport'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($sendReport)) { $_tempBody = $sendReport; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendTestEmail + * + * Send an email campaign to your test list + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendTestEmail $emailTo emailTo (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendTestEmail($campaignId, $emailTo) + { + $this->sendTestEmailWithHttpInfo($campaignId, $emailTo); + } + + /** + * Operation sendTestEmailWithHttpInfo + * + * Send an email campaign to your test list + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendTestEmailWithHttpInfo($campaignId, $emailTo) + { + $returnType = ''; + $request = $this->sendTestEmailRequest($campaignId, $emailTo); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/emailCampaigns/{campaignId}/sendReport' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\PostSendFailed', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation sendTestEmail + * Operation sendTestEmailAsync * * Send an email campaign to your test list * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendTestEmail($campaignId, $emailTo) + public function sendTestEmailAsync($campaignId, $emailTo) { - list($response) = $this->sendTestEmailWithHttpInfo($campaignId, $emailTo); - return $response; + return $this->sendTestEmailAsyncWithHttpInfo($campaignId, $emailTo) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation sendTestEmailWithHttpInfo + * Operation sendTestEmailAsyncWithHttpInfo * * Send an email campaign to your test list * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendTestEmailWithHttpInfo($campaignId, $emailTo) + public function sendTestEmailAsyncWithHttpInfo($campaignId, $emailTo) + { + $returnType = ''; + $request = $this->sendTestEmailRequest($campaignId, $emailTo); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'sendTestEmail' + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\SendTestEmail $emailTo (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendTestEmailRequest($campaignId, $emailTo) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling sendTestEmail'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling sendTestEmail' + ); } // verify the required parameter 'emailTo' is set if ($emailTo === null) { - throw new \InvalidArgumentException('Missing the required parameter $emailTo when calling sendTestEmail'); + throw new \InvalidArgumentException( + 'Missing the required parameter $emailTo when calling sendTestEmail' + ); } - // parse inputs - $resourcePath = "/emailCampaigns/{campaignId}/sendTest"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns/{campaignId}/sendTest'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($emailTo)) { $_tempBody = $emailTo; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateCampaignStatus + * + * Update a campaign status + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateCampaignStatus($campaignId, $status) + { + $this->updateCampaignStatusWithHttpInfo($campaignId, $status); + } + + /** + * Operation updateCampaignStatusWithHttpInfo + * + * Update a campaign status + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateCampaignStatusWithHttpInfo($campaignId, $status) + { + $returnType = ''; + $request = $this->updateCampaignStatusRequest($campaignId, $status); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/emailCampaigns/{campaignId}/sendTest' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostSendFailed', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateCampaignStatus + * Operation updateCampaignStatusAsync * * Update a campaign status * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateCampaignStatus($campaignId, $status) + public function updateCampaignStatusAsync($campaignId, $status) { - list($response) = $this->updateCampaignStatusWithHttpInfo($campaignId, $status); - return $response; + return $this->updateCampaignStatusAsyncWithHttpInfo($campaignId, $status) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateCampaignStatusWithHttpInfo + * Operation updateCampaignStatusAsyncWithHttpInfo * * Update a campaign status * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateCampaignStatusWithHttpInfo($campaignId, $status) + public function updateCampaignStatusAsyncWithHttpInfo($campaignId, $status) + { + $returnType = ''; + $request = $this->updateCampaignStatusRequest($campaignId, $status); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateCampaignStatus' + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateCampaignStatusRequest($campaignId, $status) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling updateCampaignStatus'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateCampaignStatus' + ); } // verify the required parameter 'status' is set if ($status === null) { - throw new \InvalidArgumentException('Missing the required parameter $status when calling updateCampaignStatus'); + throw new \InvalidArgumentException( + 'Missing the required parameter $status when calling updateCampaignStatus' + ); } - // parse inputs - $resourcePath = "/emailCampaigns/{campaignId}/status"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns/{campaignId}/status'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($status)) { $_tempBody = $status; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateEmailCampaign + * + * Update a campaign + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateEmailCampaign($campaignId, $emailCampaign) + { + $this->updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign); + } + + /** + * Operation updateEmailCampaignWithHttpInfo + * + * Update a campaign + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign) + { + $returnType = ''; + $request = $this->updateEmailCampaignRequest($campaignId, $emailCampaign); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/emailCampaigns/{campaignId}/status' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateEmailCampaign + * Operation updateEmailCampaignAsync * * Update a campaign * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateEmailCampaign($campaignId, $emailCampaign) + public function updateEmailCampaignAsync($campaignId, $emailCampaign) { - list($response) = $this->updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign); - return $response; + return $this->updateEmailCampaignAsyncWithHttpInfo($campaignId, $emailCampaign) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateEmailCampaignWithHttpInfo + * Operation updateEmailCampaignAsyncWithHttpInfo * * Update a campaign * - * @param int $campaignId Id of the campaign (required) - * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateEmailCampaignWithHttpInfo($campaignId, $emailCampaign) + public function updateEmailCampaignAsyncWithHttpInfo($campaignId, $emailCampaign) + { + $returnType = ''; + $request = $this->updateEmailCampaignRequest($campaignId, $emailCampaign); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateEmailCampaign' + * + * @param int $campaignId Id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateEmailCampaign $emailCampaign Values to update a campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateEmailCampaignRequest($campaignId, $emailCampaign) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling updateEmailCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateEmailCampaign' + ); } // verify the required parameter 'emailCampaign' is set if ($emailCampaign === null) { - throw new \InvalidArgumentException('Missing the required parameter $emailCampaign when calling updateEmailCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $emailCampaign when calling updateEmailCampaign' + ); } - // parse inputs - $resourcePath = "/emailCampaigns/{campaignId}"; - $httpBody = ''; + + $resourcePath = '/emailCampaigns/{campaignId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($emailCampaign)) { $_tempBody = $emailCampaign; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/emailCampaigns/{campaignId}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/FoldersApi.php b/lib/Api/FoldersApi.php index 67b5ca33..8add33ab 100644 --- a/lib/Api/FoldersApi.php +++ b/lib/Api/FoldersApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * FoldersApi Class Doc Comment @@ -44,47 +50,36 @@ class FoldersApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return FoldersApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,8 +87,10 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Create a folder * - * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateModel */ public function createFolder($createFolder) @@ -107,27 +104,181 @@ public function createFolder($createFolder) * * Create a folder * - * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) */ public function createFolderWithHttpInfo($createFolder) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createFolderRequest($createFolder); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createFolderAsync + * + * Create a folder + * + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createFolderAsync($createFolder) + { + return $this->createFolderAsyncWithHttpInfo($createFolder) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createFolderAsyncWithHttpInfo + * + * Create a folder + * + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createFolderAsyncWithHttpInfo($createFolder) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createFolderRequest($createFolder); + + 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 'createFolder' + * + * @param \SendinBlue\Client\Model\CreateUpdateFolder $createFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createFolderRequest($createFolder) { // verify the required parameter 'createFolder' is set if ($createFolder === null) { - throw new \InvalidArgumentException('Missing the required parameter $createFolder when calling createFolder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createFolder when calling createFolder' + ); } - // parse inputs - $resourcePath = "/contacts/folders"; - $httpBody = ''; + + $resourcePath = '/contacts/folders'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -135,135 +286,316 @@ public function createFolderWithHttpInfo($createFolder) $_tempBody = $createFolder; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteFolder + * + * Delete a folder (and all its lists) + * + * @param int $folderId Id of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteFolder($folderId) + { + $this->deleteFolderWithHttpInfo($folderId); + } + + /** + * Operation deleteFolderWithHttpInfo + * + * Delete a folder (and all its lists) + * + * @param int $folderId Id of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteFolderWithHttpInfo($folderId) + { + $returnType = ''; + $request = $this->deleteFolderRequest($folderId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/contacts/folders' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteFolder + * Operation deleteFolderAsync * * Delete a folder (and all its lists) * - * @param int $folderId Id of the folder (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $folderId Id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteFolder($folderId) + public function deleteFolderAsync($folderId) { - list($response) = $this->deleteFolderWithHttpInfo($folderId); - return $response; + return $this->deleteFolderAsyncWithHttpInfo($folderId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteFolderWithHttpInfo + * Operation deleteFolderAsyncWithHttpInfo * * Delete a folder (and all its lists) * - * @param int $folderId Id of the folder (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $folderId Id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteFolderWithHttpInfo($folderId) + public function deleteFolderAsyncWithHttpInfo($folderId) + { + $returnType = ''; + $request = $this->deleteFolderRequest($folderId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteFolder' + * + * @param int $folderId Id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteFolderRequest($folderId) { // verify the required parameter 'folderId' is set if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling deleteFolder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling deleteFolder' + ); } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}"; - $httpBody = ''; + + $resourcePath = '/contacts/folders/{folderId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($folderId !== null) { $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/folders/{folderId}' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -271,8 +603,10 @@ public function deleteFolderWithHttpInfo($folderId) * * Returns folder details * - * @param int $folderId id of the folder (required) + * @param int $folderId id of the folder (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetFolder */ public function getFolder($folderId) @@ -286,200 +620,582 @@ public function getFolder($folderId) * * Returns folder details * - * @param int $folderId id of the folder (required) + * @param int $folderId id of the folder (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetFolder, HTTP status code, HTTP response headers (array of strings) */ public function getFolderWithHttpInfo($folderId) { - // verify the required parameter 'folderId' is set - if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling getFolder'); - } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); - - // path params - if ($folderId !== null) { - $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), - $resourcePath - ); - } + $returnType = '\SendinBlue\Client\Model\GetFolder'; + $request = $this->getFolderRequest($folderId); - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetFolder', - '/contacts/folders/{folderId}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolder', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolder', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetFolder', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getFolderLists + * Operation getFolderAsync * - * Get the lists in a folder + * Returns folder details * - * @param int $folderId Id of the folder (required) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetFolderLists + * @param int $folderId id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFolderLists($folderId, $limit = '10', $offset = '0') + public function getFolderAsync($folderId) { - list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset); - return $response; + return $this->getFolderAsyncWithHttpInfo($folderId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getFolderListsWithHttpInfo + * Operation getFolderAsyncWithHttpInfo * - * Get the lists in a folder + * Returns folder details * - * @param int $folderId Id of the folder (required) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings) + * @param int $folderId id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0') + public function getFolderAsyncWithHttpInfo($folderId) + { + $returnType = '\SendinBlue\Client\Model\GetFolder'; + $request = $this->getFolderRequest($folderId); + + 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 'getFolder' + * + * @param int $folderId id of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getFolderRequest($folderId) { // verify the required parameter 'folderId' is set if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling getFolderLists'); - } - if (!is_null($limit) && ($limit > 50)) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling FoldersApi.getFolderLists, must be smaller than or equal to 50.'); + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling getFolder' + ); } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}/lists"; - $httpBody = ''; + $resourcePath = '/contacts/folders/{folderId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + - // query params - if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); - } - // query params - if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); - } // path params if ($folderId !== null) { $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), $resourcePath ); } - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + // 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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 getFolderLists + * + * Get the lists in a folder + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetFolderLists + */ + public function getFolderLists($folderId, $limit = '10', $offset = '0') + { + list($response) = $this->getFolderListsWithHttpInfo($folderId, $limit, $offset); + return $response; + } + + /** + * Operation getFolderListsWithHttpInfo + * + * Get the lists in a folder + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings) + */ + public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetFolderLists'; + $request = $this->getFolderListsRequest($folderId, $limit, $offset); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetFolderLists', - '/contacts/folders/{folderId}/lists' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolderLists', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolderLists', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetFolderLists', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } + /** + * Operation getFolderListsAsync + * + * Get the lists in a folder + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFolderListsAsync($folderId, $limit = '10', $offset = '0') + { + return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getFolderListsAsyncWithHttpInfo + * + * Get the lists in a folder + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetFolderLists'; + $request = $this->getFolderListsRequest($folderId, $limit, $offset); + + 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 'getFolderLists' + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0') + { + // verify the required parameter 'folderId' is set + if ($folderId === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling getFolderLists' + ); + } + if ($limit !== null && $limit > 50) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling FoldersApi.getFolderLists, must be smaller than or equal to 50.'); + } + + + $resourcePath = '/contacts/folders/{folderId}/lists'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($limit !== null) { + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); + } + // query params + if ($offset !== null) { + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + // path params + if ($folderId !== null) { + $resourcePath = str_replace( + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), + $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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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 getFolders * * Get all the folders * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetFolders */ public function getFolders($limit, $offset) @@ -493,185 +1209,549 @@ public function getFolders($limit, $offset) * * Get all the folders * - * @param int $limit Number of documents per page (required) - * @param int $offset Index of the first document of the page (required) + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetFolders, HTTP status code, HTTP response headers (array of strings) */ public function getFoldersWithHttpInfo($limit, $offset) + { + $returnType = '\SendinBlue\Client\Model\GetFolders'; + $request = $this->getFoldersRequest($limit, $offset); + + 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\GetFolders', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getFoldersAsync + * + * Get all the folders + * + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFoldersAsync($limit, $offset) + { + return $this->getFoldersAsyncWithHttpInfo($limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getFoldersAsyncWithHttpInfo + * + * Get all the folders + * + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFoldersAsyncWithHttpInfo($limit, $offset) + { + $returnType = '\SendinBlue\Client\Model\GetFolders'; + $request = $this->getFoldersRequest($limit, $offset); + + 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 'getFolders' + * + * @param int $limit Number of documents per page (required) + * @param int $offset Index of the first document of the page (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getFoldersRequest($limit, $offset) { // verify the required parameter 'limit' is set if ($limit === null) { - throw new \InvalidArgumentException('Missing the required parameter $limit when calling getFolders'); + throw new \InvalidArgumentException( + 'Missing the required parameter $limit when calling getFolders' + ); } - if (($limit > 50)) { + if ($limit > 50) { throw new \InvalidArgumentException('invalid value for "$limit" when calling FoldersApi.getFolders, must be smaller than or equal to 50.'); } // verify the required parameter 'offset' is set if ($offset === null) { - throw new \InvalidArgumentException('Missing the required parameter $offset when calling getFolders'); + throw new \InvalidArgumentException( + 'Missing the required parameter $offset when calling getFolders' + ); } - // parse inputs - $resourcePath = "/contacts/folders"; - $httpBody = ''; + + $resourcePath = '/contacts/folders'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 updateFolder + * + * Update a contact folder + * + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateFolder($folderId, $updateFolder) + { + $this->updateFolderWithHttpInfo($folderId, $updateFolder); + } + + /** + * Operation updateFolderWithHttpInfo + * + * Update a contact folder + * + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateFolderWithHttpInfo($folderId, $updateFolder) + { + $returnType = ''; + $request = $this->updateFolderRequest($folderId, $updateFolder); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetFolders', - '/contacts/folders' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolders', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolders', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateFolder + * Operation updateFolderAsync * * Update a contact folder * - * @param int $folderId Id of the folder (required) - * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateFolder($folderId, $updateFolder) + public function updateFolderAsync($folderId, $updateFolder) { - list($response) = $this->updateFolderWithHttpInfo($folderId, $updateFolder); - return $response; + return $this->updateFolderAsyncWithHttpInfo($folderId, $updateFolder) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateFolderWithHttpInfo + * Operation updateFolderAsyncWithHttpInfo * * Update a contact folder * - * @param int $folderId Id of the folder (required) - * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateFolderWithHttpInfo($folderId, $updateFolder) + public function updateFolderAsyncWithHttpInfo($folderId, $updateFolder) + { + $returnType = ''; + $request = $this->updateFolderRequest($folderId, $updateFolder); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateFolder' + * + * @param int $folderId Id of the folder (required) + * @param \SendinBlue\Client\Model\CreateUpdateFolder $updateFolder Name of the folder (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateFolderRequest($folderId, $updateFolder) { // verify the required parameter 'folderId' is set if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling updateFolder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling updateFolder' + ); } // verify the required parameter 'updateFolder' is set if ($updateFolder === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateFolder when calling updateFolder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateFolder when calling updateFolder' + ); } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}"; - $httpBody = ''; + + $resourcePath = '/contacts/folders/{folderId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($folderId !== null) { $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateFolder)) { $_tempBody = $updateFolder; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/folders/{folderId}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/ListsApi.php b/lib/Api/ListsApi.php index 5e2a6699..1a1ac9f8 100644 --- a/lib/Api/ListsApi.php +++ b/lib/Api/ListsApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * ListsApi Class Doc Comment @@ -44,47 +50,36 @@ class ListsApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return ListsApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,9 +87,11 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Add existing contacts to a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\PostContactInfo */ public function addContactToList($listId, $contactEmails) @@ -108,132 +105,477 @@ public function addContactToList($listId, $contactEmails) * * Add existing contacts to a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings) */ public function addContactToListWithHttpInfo($listId, $contactEmails) + { + $returnType = '\SendinBlue\Client\Model\PostContactInfo'; + $request = $this->addContactToListRequest($listId, $contactEmails); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\PostContactInfo', + $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 addContactToListAsync + * + * Add existing contacts to a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addContactToListAsync($listId, $contactEmails) + { + return $this->addContactToListAsyncWithHttpInfo($listId, $contactEmails) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addContactToListAsyncWithHttpInfo + * + * Add existing contacts to a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addContactToListAsyncWithHttpInfo($listId, $contactEmails) + { + $returnType = '\SendinBlue\Client\Model\PostContactInfo'; + $request = $this->addContactToListRequest($listId, $contactEmails); + + 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 'addContactToList' + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\AddContactToList $contactEmails Emails addresses of the contacts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function addContactToListRequest($listId, $contactEmails) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling addContactToList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling addContactToList' + ); } // verify the required parameter 'contactEmails' is set if ($contactEmails === null) { - throw new \InvalidArgumentException('Missing the required parameter $contactEmails when calling addContactToList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $contactEmails when calling addContactToList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}/contacts/add"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}/contacts/add'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $resourcePath ); } + // body params $_tempBody = null; if (isset($contactEmails)) { $_tempBody = $contactEmails; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createList + * + * Create a list + * + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\CreateModel + */ + public function createList($createList) + { + list($response) = $this->createListWithHttpInfo($createList); + return $response; + } + + /** + * Operation createListWithHttpInfo + * + * Create a list + * + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + */ + public function createListWithHttpInfo($createList) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createListRequest($createList); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\PostContactInfo', - '/contacts/lists/{listId}/contacts/add' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\PostContactInfo', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostContactInfo', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation createList + * Operation createListAsync * * Create a list * - * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\CreateModel + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createList($createList) + public function createListAsync($createList) { - list($response) = $this->createListWithHttpInfo($createList); - return $response; + return $this->createListAsyncWithHttpInfo($createList) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation createListWithHttpInfo + * Operation createListAsyncWithHttpInfo * * Create a list * - * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createListWithHttpInfo($createList) + public function createListAsyncWithHttpInfo($createList) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createListRequest($createList); + + 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 'createList' + * + * @param \SendinBlue\Client\Model\CreateList $createList Values to create a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createListRequest($createList) { // verify the required parameter 'createList' is set if ($createList === null) { - throw new \InvalidArgumentException('Missing the required parameter $createList when calling createList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createList when calling createList' + ); } - // parse inputs - $resourcePath = "/contacts/lists"; - $httpBody = ''; + + $resourcePath = '/contacts/lists'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -241,44 +583,70 @@ public function createListWithHttpInfo($createList) $_tempBody = $createList; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/contacts/lists' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -286,14 +654,15 @@ public function createListWithHttpInfo($createList) * * Delete a list * - * @param int $listId Id of the list (required) + * @param int $listId Id of the list (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ public function deleteList($listId) { - list($response) = $this->deleteListWithHttpInfo($listId); - return $response; + $this->deleteListWithHttpInfo($listId); } /** @@ -301,203 +670,556 @@ public function deleteList($listId) * * Delete a list * - * @param int $listId Id of the list (required) + * @param int $listId Id of the list (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteListWithHttpInfo($listId) { - // verify the required parameter 'listId' is set - if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling deleteList'); - } - // parse inputs - $resourcePath = "/contacts/lists/{listId}"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); - - // path params - if ($listId !== null) { - $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), - $resourcePath - ); - } + $returnType = ''; + $request = $this->deleteListRequest($listId); - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/lists/{listId}' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getContactsFromList + * Operation deleteListAsync * - * Get the contacts in a list + * Delete a list * - * @param int $listId Id of the list (required) - * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetContacts + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0') + public function deleteListAsync($listId) { - list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset); - return $response; + return $this->deleteListAsyncWithHttpInfo($listId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getContactsFromListWithHttpInfo + * Operation deleteListAsyncWithHttpInfo * - * Get the contacts in a list + * Delete a list * - * @param int $listId Id of the list (required) - * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) - * @param int $limit Number of documents per page (optional, default to 50) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0') + public function deleteListAsyncWithHttpInfo($listId) + { + $returnType = ''; + $request = $this->deleteListRequest($listId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteList' + * + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteListRequest($listId) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling getContactsFromList'); - } - if (!is_null($limit) && ($limit > 500)) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling ListsApi.getContactsFromList, must be smaller than or equal to 500.'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling deleteList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}/contacts"; - $httpBody = ''; + $resourcePath = '/contacts/lists/{listId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + - // query params - if ($modifiedSince !== null) { - $queryParams['modifiedSince'] = $this->apiClient->getSerializer()->toQueryValue($modifiedSince); - } - // query params - if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); - } - // query params - if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); - } // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getContactsFromList + * + * Get the contacts in a list + * + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetContacts + */ + public function getContactsFromList($listId, $modifiedSince = null, $limit = '50', $offset = '0') + { + list($response) = $this->getContactsFromListWithHttpInfo($listId, $modifiedSince, $limit, $offset); + return $response; + } + + /** + * Operation getContactsFromListWithHttpInfo + * + * Get the contacts in a list + * + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetContacts, HTTP status code, HTTP response headers (array of strings) + */ + public function getContactsFromListWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetContacts'; + $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetContacts', - '/contacts/lists/{listId}/contacts' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetContacts', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetContacts', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetContacts', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } + /** + * Operation getContactsFromListAsync + * + * Get the contacts in a list + * + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getContactsFromListAsync($listId, $modifiedSince = null, $limit = '50', $offset = '0') + { + return $this->getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getContactsFromListAsyncWithHttpInfo + * + * Get the contacts in a list + * + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getContactsFromListAsyncWithHttpInfo($listId, $modifiedSince = null, $limit = '50', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetContacts'; + $request = $this->getContactsFromListRequest($listId, $modifiedSince, $limit, $offset); + + 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 'getContactsFromList' + * + * @param int $listId Id of the list (required) + * @param \DateTime $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getContactsFromListRequest($listId, $modifiedSince = null, $limit = '50', $offset = '0') + { + // verify the required parameter 'listId' is set + if ($listId === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling getContactsFromList' + ); + } + if ($limit !== null && $limit > 500) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling ListsApi.getContactsFromList, must be smaller than or equal to 500.'); + } + + + $resourcePath = '/contacts/lists/{listId}/contacts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($modifiedSince !== null) { + $queryParams['modifiedSince'] = ObjectSerializer::toQueryValue($modifiedSince); + } + // query params + if ($limit !== null) { + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); + } + // query params + if ($offset !== null) { + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + // path params + if ($listId !== null) { + $resourcePath = str_replace( + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), + $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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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 getFolderLists * * Get the lists in a folder * - * @param int $folderId Id of the folder (required) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetFolderLists */ public function getFolderLists($folderId, $limit = '10', $offset = '0') @@ -511,281 +1233,846 @@ public function getFolderLists($folderId, $limit = '10', $offset = '0') * * Get the lists in a folder * - * @param int $folderId Id of the folder (required) - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetFolderLists, HTTP status code, HTTP response headers (array of strings) */ public function getFolderListsWithHttpInfo($folderId, $limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetFolderLists'; + $request = $this->getFolderListsRequest($folderId, $limit, $offset); + + 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\GetFolderLists', + $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 getFolderListsAsync + * + * Get the lists in a folder + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFolderListsAsync($folderId, $limit = '10', $offset = '0') + { + return $this->getFolderListsAsyncWithHttpInfo($folderId, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getFolderListsAsyncWithHttpInfo + * + * Get the lists in a folder + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getFolderListsAsyncWithHttpInfo($folderId, $limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetFolderLists'; + $request = $this->getFolderListsRequest($folderId, $limit, $offset); + + 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 'getFolderLists' + * + * @param int $folderId Id of the folder (required) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getFolderListsRequest($folderId, $limit = '10', $offset = '0') { // verify the required parameter 'folderId' is set if ($folderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $folderId when calling getFolderLists'); + throw new \InvalidArgumentException( + 'Missing the required parameter $folderId when calling getFolderLists' + ); } - if (!is_null($limit) && ($limit > 50)) { + if ($limit !== null && $limit > 50) { throw new \InvalidArgumentException('invalid value for "$limit" when calling ListsApi.getFolderLists, must be smaller than or equal to 50.'); } - // parse inputs - $resourcePath = "/contacts/folders/{folderId}/lists"; - $httpBody = ''; + + $resourcePath = '/contacts/folders/{folderId}/lists'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } + // path params if ($folderId !== null) { $resourcePath = str_replace( - "{" . "folderId" . "}", - $this->apiClient->getSerializer()->toPathValue($folderId), + '{' . 'folderId' . '}', + ObjectSerializer::toPathValue($folderId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 getList + * + * Get the details of a list + * + * @param int $listId Id of the list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetExtendedList + */ + public function getList($listId) + { + list($response) = $this->getListWithHttpInfo($listId); + return $response; + } + + /** + * Operation getListWithHttpInfo + * + * Get the details of a list + * + * @param int $listId Id of the list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings) + */ + public function getListWithHttpInfo($listId) + { + $returnType = '\SendinBlue\Client\Model\GetExtendedList'; + $request = $this->getListRequest($listId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetFolderLists', - '/contacts/folders/{folderId}/lists' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetFolderLists', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetFolderLists', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetExtendedList', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getList + * Operation getListAsync + * + * Get the details of a list + * + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getListAsync($listId) + { + return $this->getListAsyncWithHttpInfo($listId) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getListAsyncWithHttpInfo * * Get the details of a list * - * @param int $listId Id of the list (required) + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getListAsyncWithHttpInfo($listId) + { + $returnType = '\SendinBlue\Client\Model\GetExtendedList'; + $request = $this->getListRequest($listId); + + 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 'getList' + * + * @param int $listId Id of the list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getListRequest($listId) + { + // verify the required parameter 'listId' is set + if ($listId === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling getList' + ); + } + + $resourcePath = '/contacts/lists/{listId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($listId !== null) { + $resourcePath = str_replace( + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), + $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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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 getLists + * + * Get all the lists + * + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetExtendedList + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetLists */ - public function getList($listId) + public function getLists($limit = '10', $offset = '0') { - list($response) = $this->getListWithHttpInfo($listId); + list($response) = $this->getListsWithHttpInfo($limit, $offset); return $response; } /** - * Operation getListWithHttpInfo + * Operation getListsWithHttpInfo * - * Get the details of a list + * Get all the lists + * + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) * - * @param int $listId Id of the list (required) * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetExtendedList, HTTP status code, HTTP response headers (array of strings) + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings) */ - public function getListWithHttpInfo($listId) + public function getListsWithHttpInfo($limit = '10', $offset = '0') { - // verify the required parameter 'listId' is set - if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling getList'); - } - // parse inputs - $resourcePath = "/contacts/lists/{listId}"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); - - // path params - if ($listId !== null) { - $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), - $resourcePath - ); - } + $returnType = '\SendinBlue\Client\Model\GetLists'; + $request = $this->getListsRequest($limit, $offset); - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetExtendedList', - '/contacts/lists/{listId}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetExtendedList', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetExtendedList', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetLists', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getLists + * Operation getListsAsync * * Get all the lists * - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetLists + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getLists($limit = '10', $offset = '0') + public function getListsAsync($limit = '10', $offset = '0') { - list($response) = $this->getListsWithHttpInfo($limit, $offset); - return $response; + return $this->getListsAsyncWithHttpInfo($limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getListsWithHttpInfo + * Operation getListsAsyncWithHttpInfo * * Get all the lists * - * @param int $limit Number of documents per page (optional, default to 10) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetLists, HTTP status code, HTTP response headers (array of strings) + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getListsWithHttpInfo($limit = '10', $offset = '0') + public function getListsAsyncWithHttpInfo($limit = '10', $offset = '0') { - if (!is_null($limit) && ($limit > 50)) { + $returnType = '\SendinBlue\Client\Model\GetLists'; + $request = $this->getListsRequest($limit, $offset); + + 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 'getLists' + * + * @param int $limit Number of documents per page (optional, default to 10) + * @param int $offset Index of the first document of the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getListsRequest($limit = '10', $offset = '0') + { + if ($limit !== null && $limit > 50) { throw new \InvalidArgumentException('invalid value for "$limit" when calling ListsApi.getLists, must be smaller than or equal to 50.'); } - // parse inputs - $resourcePath = "/contacts/lists"; - $httpBody = ''; + + $resourcePath = '/contacts/lists'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetLists', - '/contacts/lists' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetLists', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetLists', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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 + ); } /** @@ -793,9 +2080,11 @@ public function getListsWithHttpInfo($limit = '10', $offset = '0') * * Remove existing contacts from a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\PostContactInfo */ public function removeContactFromList($listId, $contactEmails) @@ -809,190 +2098,556 @@ public function removeContactFromList($listId, $contactEmails) * * Remove existing contacts from a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\PostContactInfo, HTTP status code, HTTP response headers (array of strings) */ public function removeContactFromListWithHttpInfo($listId, $contactEmails) + { + $returnType = '\SendinBlue\Client\Model\PostContactInfo'; + $request = $this->removeContactFromListRequest($listId, $contactEmails); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\PostContactInfo', + $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 removeContactFromListAsync + * + * Remove existing contacts from a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function removeContactFromListAsync($listId, $contactEmails) + { + return $this->removeContactFromListAsyncWithHttpInfo($listId, $contactEmails) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation removeContactFromListAsyncWithHttpInfo + * + * Remove existing contacts from a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function removeContactFromListAsyncWithHttpInfo($listId, $contactEmails) + { + $returnType = '\SendinBlue\Client\Model\PostContactInfo'; + $request = $this->removeContactFromListRequest($listId, $contactEmails); + + 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 'removeContactFromList' + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\RemoveContactFromList $contactEmails Emails adresses of the contact (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function removeContactFromListRequest($listId, $contactEmails) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling removeContactFromList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling removeContactFromList' + ); } // verify the required parameter 'contactEmails' is set if ($contactEmails === null) { - throw new \InvalidArgumentException('Missing the required parameter $contactEmails when calling removeContactFromList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $contactEmails when calling removeContactFromList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}/contacts/remove"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}/contacts/remove'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $resourcePath ); } + // body params $_tempBody = null; if (isset($contactEmails)) { $_tempBody = $contactEmails; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateList + * + * Update a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateList($listId, $updateList) + { + $this->updateListWithHttpInfo($listId, $updateList); + } + + /** + * Operation updateListWithHttpInfo + * + * Update a list + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateListWithHttpInfo($listId, $updateList) + { + $returnType = ''; + $request = $this->updateListRequest($listId, $updateList); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\PostContactInfo', - '/contacts/lists/{listId}/contacts/remove' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\PostContactInfo', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostContactInfo', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateList + * Operation updateListAsync * * Update a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateList($listId, $updateList) + public function updateListAsync($listId, $updateList) { - list($response) = $this->updateListWithHttpInfo($listId, $updateList); - return $response; + return $this->updateListAsyncWithHttpInfo($listId, $updateList) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateListWithHttpInfo + * Operation updateListAsyncWithHttpInfo * * Update a list * - * @param int $listId Id of the list (required) - * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateListWithHttpInfo($listId, $updateList) + public function updateListAsyncWithHttpInfo($listId, $updateList) + { + $returnType = ''; + $request = $this->updateListRequest($listId, $updateList); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateList' + * + * @param int $listId Id of the list (required) + * @param \SendinBlue\Client\Model\UpdateList $updateList Values to update a list (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateListRequest($listId, $updateList) { // verify the required parameter 'listId' is set if ($listId === null) { - throw new \InvalidArgumentException('Missing the required parameter $listId when calling updateList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $listId when calling updateList' + ); } // verify the required parameter 'updateList' is set if ($updateList === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateList when calling updateList'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateList when calling updateList' + ); } - // parse inputs - $resourcePath = "/contacts/lists/{listId}"; - $httpBody = ''; + + $resourcePath = '/contacts/lists/{listId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($listId !== null) { $resourcePath = str_replace( - "{" . "listId" . "}", - $this->apiClient->getSerializer()->toPathValue($listId), + '{' . 'listId' . '}', + ObjectSerializer::toPathValue($listId), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateList)) { $_tempBody = $updateList; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/contacts/lists/{listId}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/ProcessApi.php b/lib/Api/ProcessApi.php index 97b2eb7c..e8404e60 100644 --- a/lib/Api/ProcessApi.php +++ b/lib/Api/ProcessApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * ProcessApi Class Doc Comment @@ -44,47 +50,36 @@ class ProcessApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return ProcessApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,8 +87,10 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Return the informations for a process * - * @param int $processId Id of the process (required) + * @param int $processId Id of the process (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetProcess */ public function getProcess($processId) @@ -107,171 +104,561 @@ public function getProcess($processId) * * Return the informations for a process * - * @param int $processId Id of the process (required) + * @param int $processId Id of the process (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetProcess, HTTP status code, HTTP response headers (array of strings) */ public function getProcessWithHttpInfo($processId) + { + $returnType = '\SendinBlue\Client\Model\GetProcess'; + $request = $this->getProcessRequest($processId); + + 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\GetProcess', + $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 getProcessAsync + * + * Return the informations for a process + * + * @param int $processId Id of the process (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProcessAsync($processId) + { + return $this->getProcessAsyncWithHttpInfo($processId) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProcessAsyncWithHttpInfo + * + * Return the informations for a process + * + * @param int $processId Id of the process (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProcessAsyncWithHttpInfo($processId) + { + $returnType = '\SendinBlue\Client\Model\GetProcess'; + $request = $this->getProcessRequest($processId); + + 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 'getProcess' + * + * @param int $processId Id of the process (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getProcessRequest($processId) { // verify the required parameter 'processId' is set if ($processId === null) { - throw new \InvalidArgumentException('Missing the required parameter $processId when calling getProcess'); + throw new \InvalidArgumentException( + 'Missing the required parameter $processId when calling getProcess' + ); } - // parse inputs - $resourcePath = "/processes/{processId}"; - $httpBody = ''; + + $resourcePath = '/processes/{processId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($processId !== null) { $resourcePath = str_replace( - "{" . "processId" . "}", - $this->apiClient->getSerializer()->toPathValue($processId), + '{' . 'processId' . '}', + ObjectSerializer::toPathValue($processId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 getProcesses + * + * Return all the processes for your account + * + * @param int $limit Number limitation for the result returned (optional, default to 10) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetProcesses + */ + public function getProcesses($limit = '10', $offset = '0') + { + list($response) = $this->getProcessesWithHttpInfo($limit, $offset); + return $response; + } + + /** + * Operation getProcessesWithHttpInfo + * + * Return all the processes for your account + * + * @param int $limit Number limitation for the result returned (optional, default to 10) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetProcesses, HTTP status code, HTTP response headers (array of strings) + */ + public function getProcessesWithHttpInfo($limit = '10', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetProcesses'; + $request = $this->getProcessesRequest($limit, $offset); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetProcess', - '/processes/{processId}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetProcess', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetProcess', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetProcesses', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getProcesses + * Operation getProcessesAsync * * Return all the processes for your account * - * @param int $limit Number limitation for the result returned (optional, default to 10) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetProcesses + * @param int $limit Number limitation for the result returned (optional, default to 10) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getProcesses($limit = '10', $offset = '0') + public function getProcessesAsync($limit = '10', $offset = '0') { - list($response) = $this->getProcessesWithHttpInfo($limit, $offset); - return $response; + return $this->getProcessesAsyncWithHttpInfo($limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getProcessesWithHttpInfo + * Operation getProcessesAsyncWithHttpInfo * * Return all the processes for your account * - * @param int $limit Number limitation for the result returned (optional, default to 10) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetProcesses, HTTP status code, HTTP response headers (array of strings) + * @param int $limit Number limitation for the result returned (optional, default to 10) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getProcessesWithHttpInfo($limit = '10', $offset = '0') + public function getProcessesAsyncWithHttpInfo($limit = '10', $offset = '0') { - if (!is_null($limit) && ($limit > 50)) { + $returnType = '\SendinBlue\Client\Model\GetProcesses'; + $request = $this->getProcessesRequest($limit, $offset); + + 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 'getProcesses' + * + * @param int $limit Number limitation for the result returned (optional, default to 10) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getProcessesRequest($limit = '10', $offset = '0') + { + if ($limit !== null && $limit > 50) { throw new \InvalidArgumentException('invalid value for "$limit" when calling ProcessApi.getProcesses, must be smaller than or equal to 50.'); } - // parse inputs - $resourcePath = "/processes"; - $httpBody = ''; + + $resourcePath = '/processes'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetProcesses', - '/processes' - ); - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetProcesses', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetProcesses', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/ResellerApi.php b/lib/Api/ResellerApi.php index 0678caea..32ab5ab0 100644 --- a/lib/Api/ResellerApi.php +++ b/lib/Api/ResellerApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * ResellerApi Class Doc Comment @@ -44,47 +50,36 @@ class ResellerApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return ResellerApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,9 +87,11 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Add Email and/or SMS credits to a specific child account * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\RemainingCreditModel */ public function addCredits($childAuthKey, $addCredits) @@ -108,195 +105,546 @@ public function addCredits($childAuthKey, $addCredits) * * Add Email and/or SMS credits to a specific child account * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\RemainingCreditModel, HTTP status code, HTTP response headers (array of strings) */ public function addCreditsWithHttpInfo($childAuthKey, $addCredits) + { + $returnType = '\SendinBlue\Client\Model\RemainingCreditModel'; + $request = $this->addCreditsRequest($childAuthKey, $addCredits); + + 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\RemainingCreditModel', + $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 addCreditsAsync + * + * Add Email and/or SMS credits to a specific child account + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addCreditsAsync($childAuthKey, $addCredits) + { + return $this->addCreditsAsyncWithHttpInfo($childAuthKey, $addCredits) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addCreditsAsyncWithHttpInfo + * + * Add Email and/or SMS credits to a specific child account + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addCreditsAsyncWithHttpInfo($childAuthKey, $addCredits) + { + $returnType = '\SendinBlue\Client\Model\RemainingCreditModel'; + $request = $this->addCreditsRequest($childAuthKey, $addCredits); + + 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 'addCredits' + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\AddCredits $addCredits Values to post to add credit to a specific child account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function addCreditsRequest($childAuthKey, $addCredits) { // verify the required parameter 'childAuthKey' is set if ($childAuthKey === null) { - throw new \InvalidArgumentException('Missing the required parameter $childAuthKey when calling addCredits'); + throw new \InvalidArgumentException( + 'Missing the required parameter $childAuthKey when calling addCredits' + ); } // verify the required parameter 'addCredits' is set if ($addCredits === null) { - throw new \InvalidArgumentException('Missing the required parameter $addCredits when calling addCredits'); + throw new \InvalidArgumentException( + 'Missing the required parameter $addCredits when calling addCredits' + ); } - // parse inputs - $resourcePath = "/reseller/children/{childAuthKey}/credits/add"; - $httpBody = ''; + + $resourcePath = '/reseller/children/{childAuthKey}/credits/add'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($childAuthKey !== null) { $resourcePath = str_replace( - "{" . "childAuthKey" . "}", - $this->apiClient->getSerializer()->toPathValue($childAuthKey), + '{' . 'childAuthKey' . '}', + ObjectSerializer::toPathValue($childAuthKey), $resourcePath ); } + // body params $_tempBody = null; if (isset($addCredits)) { $_tempBody = $addCredits; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation associateIpToChild + * + * Associate a dedicated IP to the child + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function associateIpToChild($childAuthKey, $ip) + { + $this->associateIpToChildWithHttpInfo($childAuthKey, $ip); + } + + /** + * Operation associateIpToChildWithHttpInfo + * + * Associate a dedicated IP to the child + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function associateIpToChildWithHttpInfo($childAuthKey, $ip) + { + $returnType = ''; + $request = $this->associateIpToChildRequest($childAuthKey, $ip); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\RemainingCreditModel', - '/reseller/children/{childAuthKey}/credits/add' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\RemainingCreditModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\RemainingCreditModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 403: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation associateIpToChild + * Operation associateIpToChildAsync * * Associate a dedicated IP to the child * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function associateIpToChild($childAuthKey, $ip) + public function associateIpToChildAsync($childAuthKey, $ip) { - list($response) = $this->associateIpToChildWithHttpInfo($childAuthKey, $ip); - return $response; + return $this->associateIpToChildAsyncWithHttpInfo($childAuthKey, $ip) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation associateIpToChildWithHttpInfo + * Operation associateIpToChildAsyncWithHttpInfo * * Associate a dedicated IP to the child * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function associateIpToChildWithHttpInfo($childAuthKey, $ip) + public function associateIpToChildAsyncWithHttpInfo($childAuthKey, $ip) + { + $returnType = ''; + $request = $this->associateIpToChildRequest($childAuthKey, $ip); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'associateIpToChild' + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to associate (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function associateIpToChildRequest($childAuthKey, $ip) { // verify the required parameter 'childAuthKey' is set if ($childAuthKey === null) { - throw new \InvalidArgumentException('Missing the required parameter $childAuthKey when calling associateIpToChild'); + throw new \InvalidArgumentException( + 'Missing the required parameter $childAuthKey when calling associateIpToChild' + ); } // verify the required parameter 'ip' is set if ($ip === null) { - throw new \InvalidArgumentException('Missing the required parameter $ip when calling associateIpToChild'); + throw new \InvalidArgumentException( + 'Missing the required parameter $ip when calling associateIpToChild' + ); } - // parse inputs - $resourcePath = "/reseller/children/{childAuthKey}/ips/associate"; - $httpBody = ''; + + $resourcePath = '/reseller/children/{childAuthKey}/ips/associate'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($childAuthKey !== null) { $resourcePath = str_replace( - "{" . "childAuthKey" . "}", - $this->apiClient->getSerializer()->toPathValue($childAuthKey), + '{' . 'childAuthKey' . '}', + ObjectSerializer::toPathValue($childAuthKey), $resourcePath ); } + // body params $_tempBody = null; if (isset($ip)) { $_tempBody = $ip; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/reseller/children/{childAuthKey}/ips/associate' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -304,8 +652,10 @@ public function associateIpToChildWithHttpInfo($childAuthKey, $ip) * * Creates a reseller child * - * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional) + * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateReseller */ public function createResellerChild($resellerChild = null) @@ -319,183 +669,525 @@ public function createResellerChild($resellerChild = null) * * Creates a reseller child * - * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional) + * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateReseller, HTTP status code, HTTP response headers (array of strings) */ public function createResellerChildWithHttpInfo($resellerChild = null) { - // parse inputs - $resourcePath = "/reseller/children"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); - - // body params - $_tempBody = null; - if (isset($resellerChild)) { - $_tempBody = $resellerChild; - } + $returnType = '\SendinBlue\Client\Model\CreateReseller'; + $request = $this->createResellerChildRequest($resellerChild); - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateReseller', - '/reseller/children' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateReseller', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateReseller', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateReseller', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 403: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteResellerChild + * Operation createResellerChildAsync * - * Deletes a single reseller child based on the childAuthKey supplied + * Creates a reseller child * - * @param string $childAuthKey auth key of reseller's child (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteResellerChild($childAuthKey) + public function createResellerChildAsync($resellerChild = null) { - list($response) = $this->deleteResellerChildWithHttpInfo($childAuthKey); - return $response; + return $this->createResellerChildAsyncWithHttpInfo($resellerChild) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteResellerChildWithHttpInfo + * Operation createResellerChildAsyncWithHttpInfo * - * Deletes a single reseller child based on the childAuthKey supplied + * Creates a reseller child * - * @param string $childAuthKey auth key of reseller's child (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteResellerChildWithHttpInfo($childAuthKey) + public function createResellerChildAsyncWithHttpInfo($resellerChild = null) { - // verify the required parameter 'childAuthKey' is set - if ($childAuthKey === null) { - throw new \InvalidArgumentException('Missing the required parameter $childAuthKey when calling deleteResellerChild'); - } - // parse inputs - $resourcePath = "/reseller/children/{childAuthKey}"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $returnType = '\SendinBlue\Client\Model\CreateReseller'; + $request = $this->createResellerChildRequest($resellerChild); - // path params - if ($childAuthKey !== null) { - $resourcePath = str_replace( - "{" . "childAuthKey" . "}", - $this->apiClient->getSerializer()->toPathValue($childAuthKey), - $resourcePath - ); - } + 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); + } + } - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/reseller/children/{childAuthKey}' + 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() + ); + } ); + } - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + /** + * Create request for operation 'createResellerChild' + * + * @param \SendinBlue\Client\Model\CreateChild $resellerChild reseller child to add (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createResellerChildRequest($resellerChild = null) + { + + $resourcePath = '/reseller/children'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($resellerChild)) { + $_tempBody = $resellerChild; + } + + 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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteResellerChild + * + * Deletes a single reseller child based on the childAuthKey supplied + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteResellerChild($childAuthKey) + { + $this->deleteResellerChildWithHttpInfo($childAuthKey); + } + + /** + * Operation deleteResellerChildWithHttpInfo + * + * Deletes a single reseller child based on the childAuthKey supplied + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteResellerChildWithHttpInfo($childAuthKey) + { + $returnType = ''; + $request = $this->deleteResellerChildRequest($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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 403: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } + /** + * Operation deleteResellerChildAsync + * + * Deletes a single reseller child based on the childAuthKey supplied + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteResellerChildAsync($childAuthKey) + { + return $this->deleteResellerChildAsyncWithHttpInfo($childAuthKey) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteResellerChildAsyncWithHttpInfo + * + * Deletes a single reseller child based on the childAuthKey supplied + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteResellerChildAsyncWithHttpInfo($childAuthKey) + { + $returnType = ''; + $request = $this->deleteResellerChildRequest($childAuthKey); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteResellerChild' + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteResellerChildRequest($childAuthKey) + { + // verify the required parameter 'childAuthKey' is set + if ($childAuthKey === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $childAuthKey when calling deleteResellerChild' + ); + } + + $resourcePath = '/reseller/children/{childAuthKey}'; + $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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation dissociateIpFromChild * * Dissociate a dedicated IP to the child * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required) + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ public function dissociateIpFromChild($childAuthKey, $ip) { - list($response) = $this->dissociateIpFromChildWithHttpInfo($childAuthKey, $ip); - return $response; + $this->dissociateIpFromChildWithHttpInfo($childAuthKey, $ip); } /** @@ -503,476 +1195,1380 @@ public function dissociateIpFromChild($childAuthKey, $ip) * * Dissociate a dedicated IP to the child * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required) + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function dissociateIpFromChildWithHttpInfo($childAuthKey, $ip) + { + $returnType = ''; + $request = $this->dissociateIpFromChildRequest($childAuthKey, $ip); + + 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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + 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 dissociateIpFromChildAsync + * + * Dissociate a dedicated IP to the child + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dissociateIpFromChildAsync($childAuthKey, $ip) + { + return $this->dissociateIpFromChildAsyncWithHttpInfo($childAuthKey, $ip) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dissociateIpFromChildAsyncWithHttpInfo + * + * Dissociate a dedicated IP to the child + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dissociateIpFromChildAsyncWithHttpInfo($childAuthKey, $ip) + { + $returnType = ''; + $request = $this->dissociateIpFromChildRequest($childAuthKey, $ip); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'dissociateIpFromChild' + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\ManageIp $ip IP to dissociate (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function dissociateIpFromChildRequest($childAuthKey, $ip) { // verify the required parameter 'childAuthKey' is set if ($childAuthKey === null) { - throw new \InvalidArgumentException('Missing the required parameter $childAuthKey when calling dissociateIpFromChild'); + throw new \InvalidArgumentException( + 'Missing the required parameter $childAuthKey when calling dissociateIpFromChild' + ); } // verify the required parameter 'ip' is set if ($ip === null) { - throw new \InvalidArgumentException('Missing the required parameter $ip when calling dissociateIpFromChild'); + throw new \InvalidArgumentException( + 'Missing the required parameter $ip when calling dissociateIpFromChild' + ); } - // parse inputs - $resourcePath = "/reseller/children/{childAuthKey}/ips/dissociate"; - $httpBody = ''; + + $resourcePath = '/reseller/children/{childAuthKey}/ips/dissociate'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($childAuthKey !== null) { $resourcePath = str_replace( - "{" . "childAuthKey" . "}", - $this->apiClient->getSerializer()->toPathValue($childAuthKey), + '{' . 'childAuthKey' . '}', + ObjectSerializer::toPathValue($childAuthKey), $resourcePath ); } + // body params $_tempBody = null; if (isset($ip)) { $_tempBody = $ip; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getChildInfo + * + * Gets the info about a specific child account + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetChildInfo + */ + public function getChildInfo($childAuthKey) + { + list($response) = $this->getChildInfoWithHttpInfo($childAuthKey); + return $response; + } + + /** + * Operation getChildInfoWithHttpInfo + * + * Gets the info about a specific child account + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetChildInfo, HTTP status code, HTTP response headers (array of strings) + */ + public function getChildInfoWithHttpInfo($childAuthKey) + { + $returnType = '\SendinBlue\Client\Model\GetChildInfo'; + $request = $this->getChildInfoRequest($childAuthKey); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/reseller/children/{childAuthKey}/ips/dissociate' - ); + $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() + ]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetChildInfo', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $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 = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } + throw $e; + } + } + + /** + * Operation getChildInfoAsync + * + * Gets the info about a specific child account + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChildInfoAsync($childAuthKey) + { + return $this->getChildInfoAsyncWithHttpInfo($childAuthKey) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getChildInfoAsyncWithHttpInfo + * + * Gets the info about a specific child account + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getChildInfoAsyncWithHttpInfo($childAuthKey) + { + $returnType = '\SendinBlue\Client\Model\GetChildInfo'; + $request = $this->getChildInfoRequest($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 'getChildInfo' + * + * @param string $childAuthKey auth key of reseller's child (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getChildInfoRequest($childAuthKey) + { + // verify the required parameter 'childAuthKey' is set + if ($childAuthKey === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $childAuthKey when calling getChildInfo' + ); + } + + $resourcePath = '/reseller/children/{childAuthKey}'; + $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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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 getResellerChilds + * + * Gets the list of all reseller's children accounts + * + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetChildrenList + */ + public function getResellerChilds() + { + list($response) = $this->getResellerChildsWithHttpInfo(); + return $response; + } + + /** + * Operation getResellerChildsWithHttpInfo + * + * Gets the list of all reseller's children accounts + * + * + * @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() + { + $returnType = '\SendinBlue\Client\Model\GetChildrenList'; + $request = $this->getResellerChildsRequest(); + + 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\GetChildrenList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } throw $e; } } /** - * Operation getChildInfo + * Operation getResellerChildsAsync + * + * Gets the list of all reseller's children accounts + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getResellerChildsAsync() + { + return $this->getResellerChildsAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getResellerChildsAsyncWithHttpInfo * - * Gets the info about a specific child account + * Gets the list of all reseller's children accounts * - * @param string $childAuthKey auth key of reseller's child (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetChildInfo + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getChildInfo($childAuthKey) + public function getResellerChildsAsyncWithHttpInfo() { - list($response) = $this->getChildInfoWithHttpInfo($childAuthKey); - return $response; + $returnType = '\SendinBlue\Client\Model\GetChildrenList'; + $request = $this->getResellerChildsRequest(); + + 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() + ); + } + ); } /** - * Operation getChildInfoWithHttpInfo + * Create request for operation 'getResellerChilds' * - * Gets the info about a specific child account * - * @param string $childAuthKey auth key of reseller's child (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetChildInfo, HTTP status code, HTTP response headers (array of strings) + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request */ - public function getChildInfoWithHttpInfo($childAuthKey) + protected function getResellerChildsRequest() { - // verify the required parameter 'childAuthKey' is set - if ($childAuthKey === null) { - throw new \InvalidArgumentException('Missing the required parameter $childAuthKey when calling getChildInfo'); - } - // parse inputs - $resourcePath = "/reseller/children/{childAuthKey}"; - $httpBody = ''; + + $resourcePath = '/reseller/children'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; - // path params - if ($childAuthKey !== null) { - $resourcePath = str_replace( - "{" . "childAuthKey" . "}", - $this->apiClient->getSerializer()->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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetChildInfo', - '/reseller/children/{childAuthKey}' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetChildInfo', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetChildInfo', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 403: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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 getResellerChilds + * Operation removeCredits * - * Gets the list of all reseller's children accounts + * Remove Email and/or SMS credits from a specific child account + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) * * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetChildrenList + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\RemainingCreditModel */ - public function getResellerChilds() + public function removeCredits($childAuthKey, $removeCredits) { - list($response) = $this->getResellerChildsWithHttpInfo(); + list($response) = $this->removeCreditsWithHttpInfo($childAuthKey, $removeCredits); return $response; } /** - * Operation getResellerChildsWithHttpInfo + * Operation removeCreditsWithHttpInfo * - * Gets the list of all reseller's children accounts + * Remove Email and/or SMS credits from a specific child account + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) * * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetChildrenList, HTTP status code, HTTP response headers (array of strings) + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\RemainingCreditModel, HTTP status code, HTTP response headers (array of strings) */ - public function getResellerChildsWithHttpInfo() + public function removeCreditsWithHttpInfo($childAuthKey, $removeCredits) { - // parse inputs - $resourcePath = "/reseller/children"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $returnType = '\SendinBlue\Client\Model\RemainingCreditModel'; + $request = $this->removeCreditsRequest($childAuthKey, $removeCredits); - - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetChildrenList', - '/reseller/children' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetChildrenList', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetChildrenList', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\RemainingCreditModel', + $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 = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $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 removeCredits + * Operation removeCreditsAsync * * Remove Email and/or SMS credits from a specific child account * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\RemainingCreditModel + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function removeCredits($childAuthKey, $removeCredits) + public function removeCreditsAsync($childAuthKey, $removeCredits) { - list($response) = $this->removeCreditsWithHttpInfo($childAuthKey, $removeCredits); - return $response; + return $this->removeCreditsAsyncWithHttpInfo($childAuthKey, $removeCredits) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation removeCreditsWithHttpInfo + * Operation removeCreditsAsyncWithHttpInfo * * Remove Email and/or SMS credits from a specific child account * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\RemainingCreditModel, HTTP status code, HTTP response headers (array of strings) + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function removeCreditsWithHttpInfo($childAuthKey, $removeCredits) + public function removeCreditsAsyncWithHttpInfo($childAuthKey, $removeCredits) + { + $returnType = '\SendinBlue\Client\Model\RemainingCreditModel'; + $request = $this->removeCreditsRequest($childAuthKey, $removeCredits); + + 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 'removeCredits' + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\RemoveCredits $removeCredits Values to post to remove email or SMS credits from a specific child account (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function removeCreditsRequest($childAuthKey, $removeCredits) { // verify the required parameter 'childAuthKey' is set if ($childAuthKey === null) { - throw new \InvalidArgumentException('Missing the required parameter $childAuthKey when calling removeCredits'); + throw new \InvalidArgumentException( + 'Missing the required parameter $childAuthKey when calling removeCredits' + ); } // verify the required parameter 'removeCredits' is set if ($removeCredits === null) { - throw new \InvalidArgumentException('Missing the required parameter $removeCredits when calling removeCredits'); + throw new \InvalidArgumentException( + 'Missing the required parameter $removeCredits when calling removeCredits' + ); } - // parse inputs - $resourcePath = "/reseller/children/{childAuthKey}/credits/remove"; - $httpBody = ''; + + $resourcePath = '/reseller/children/{childAuthKey}/credits/remove'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($childAuthKey !== null) { $resourcePath = str_replace( - "{" . "childAuthKey" . "}", - $this->apiClient->getSerializer()->toPathValue($childAuthKey), + '{' . 'childAuthKey' . '}', + ObjectSerializer::toPathValue($childAuthKey), $resourcePath ); } + // body params $_tempBody = null; if (isset($removeCredits)) { $_tempBody = $removeCredits; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateResellerChild + * + * Updates infos of reseller's child based on the childAuthKey supplied + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateResellerChild($childAuthKey, $resellerChild) + { + $this->updateResellerChildWithHttpInfo($childAuthKey, $resellerChild); + } + + /** + * Operation updateResellerChildWithHttpInfo + * + * Updates infos of reseller's child based on the childAuthKey supplied + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateResellerChildWithHttpInfo($childAuthKey, $resellerChild) + { + $returnType = ''; + $request = $this->updateResellerChildRequest($childAuthKey, $resellerChild); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\RemainingCreditModel', - '/reseller/children/{childAuthKey}/credits/remove' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\RemainingCreditModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\RemainingCreditModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 403: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateResellerChild + * Operation updateResellerChildAsync * * Updates infos of reseller's child based on the childAuthKey supplied * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateResellerChild($childAuthKey, $resellerChild) + public function updateResellerChildAsync($childAuthKey, $resellerChild) { - list($response) = $this->updateResellerChildWithHttpInfo($childAuthKey, $resellerChild); - return $response; + return $this->updateResellerChildAsyncWithHttpInfo($childAuthKey, $resellerChild) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateResellerChildWithHttpInfo + * Operation updateResellerChildAsyncWithHttpInfo * * Updates infos of reseller's child based on the childAuthKey supplied * - * @param string $childAuthKey auth key of reseller's child (required) - * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateResellerChildWithHttpInfo($childAuthKey, $resellerChild) + public function updateResellerChildAsyncWithHttpInfo($childAuthKey, $resellerChild) + { + $returnType = ''; + $request = $this->updateResellerChildRequest($childAuthKey, $resellerChild); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateResellerChild' + * + * @param string $childAuthKey auth key of reseller's child (required) + * @param \SendinBlue\Client\Model\UpdateChild $resellerChild values to update in child profile (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateResellerChildRequest($childAuthKey, $resellerChild) { // verify the required parameter 'childAuthKey' is set if ($childAuthKey === null) { - throw new \InvalidArgumentException('Missing the required parameter $childAuthKey when calling updateResellerChild'); + throw new \InvalidArgumentException( + 'Missing the required parameter $childAuthKey when calling updateResellerChild' + ); } // verify the required parameter 'resellerChild' is set if ($resellerChild === null) { - throw new \InvalidArgumentException('Missing the required parameter $resellerChild when calling updateResellerChild'); + throw new \InvalidArgumentException( + 'Missing the required parameter $resellerChild when calling updateResellerChild' + ); } - // parse inputs - $resourcePath = "/reseller/children/{childAuthKey}"; - $httpBody = ''; + + $resourcePath = '/reseller/children/{childAuthKey}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($childAuthKey !== null) { $resourcePath = str_replace( - "{" . "childAuthKey" . "}", - $this->apiClient->getSerializer()->toPathValue($childAuthKey), + '{' . 'childAuthKey' . '}', + ObjectSerializer::toPathValue($childAuthKey), $resourcePath ); } + // body params $_tempBody = null; if (isset($resellerChild)) { $_tempBody = $resellerChild; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/reseller/children/{childAuthKey}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 403: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/SMSCampaignsApi.php b/lib/Api/SMSCampaignsApi.php index 5ce59140..19e862a4 100644 --- a/lib/Api/SMSCampaignsApi.php +++ b/lib/Api/SMSCampaignsApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * SMSCampaignsApi Class Doc Comment @@ -44,47 +50,36 @@ class SMSCampaignsApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return SMSCampaignsApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,8 +87,10 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Creates an SMS campaign * - * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateModel */ public function createSmsCampaign($createSmsCampaign) @@ -107,27 +104,181 @@ public function createSmsCampaign($createSmsCampaign) * * Creates an SMS campaign * - * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) */ public function createSmsCampaignWithHttpInfo($createSmsCampaign) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createSmsCampaignRequest($createSmsCampaign); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createSmsCampaignAsync + * + * Creates an SMS campaign + * + * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSmsCampaignAsync($createSmsCampaign) + { + return $this->createSmsCampaignAsyncWithHttpInfo($createSmsCampaign) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSmsCampaignAsyncWithHttpInfo + * + * Creates an SMS campaign + * + * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSmsCampaignAsyncWithHttpInfo($createSmsCampaign) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createSmsCampaignRequest($createSmsCampaign); + + 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 'createSmsCampaign' + * + * @param \SendinBlue\Client\Model\CreateSmsCampaign $createSmsCampaign Values to create an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createSmsCampaignRequest($createSmsCampaign) { // verify the required parameter 'createSmsCampaign' is set if ($createSmsCampaign === null) { - throw new \InvalidArgumentException('Missing the required parameter $createSmsCampaign when calling createSmsCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createSmsCampaign when calling createSmsCampaign' + ); } - // parse inputs - $resourcePath = "/smsCampaigns"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -135,241 +286,613 @@ public function createSmsCampaignWithHttpInfo($createSmsCampaign) $_tempBody = $createSmsCampaign; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSmsCampaign + * + * Delete the SMS campaign + * + * @param int $campaignId id of the SMS campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSmsCampaign($campaignId) + { + $this->deleteSmsCampaignWithHttpInfo($campaignId); + } + + /** + * Operation deleteSmsCampaignWithHttpInfo + * + * Delete the SMS campaign + * + * @param int $campaignId id of the SMS campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSmsCampaignWithHttpInfo($campaignId) + { + $returnType = ''; + $request = $this->deleteSmsCampaignRequest($campaignId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/smsCampaigns' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteSmsCampaign + * Operation deleteSmsCampaignAsync * * Delete the SMS campaign * - * @param int $campaignId id of the SMS campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId id of the SMS campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteSmsCampaign($campaignId) + public function deleteSmsCampaignAsync($campaignId) { - list($response) = $this->deleteSmsCampaignWithHttpInfo($campaignId); - return $response; + return $this->deleteSmsCampaignAsyncWithHttpInfo($campaignId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteSmsCampaignWithHttpInfo + * Operation deleteSmsCampaignAsyncWithHttpInfo * * Delete the SMS campaign * - * @param int $campaignId id of the SMS campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId id of the SMS campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteSmsCampaignWithHttpInfo($campaignId) + public function deleteSmsCampaignAsyncWithHttpInfo($campaignId) + { + $returnType = ''; + $request = $this->deleteSmsCampaignRequest($campaignId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteSmsCampaign' + * + * @param int $campaignId id of the SMS campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteSmsCampaignRequest($campaignId) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling deleteSmsCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling deleteSmsCampaign' + ); } - // parse inputs - $resourcePath = "/smsCampaigns/{campaignId}"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns/{campaignId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . '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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getSmsCampaign + * + * Get an SMS campaign + * + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\GetSmsCampaign $getSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetSmsCampaign + */ + public function getSmsCampaign($campaignId, $getSmsCampaign) + { + list($response) = $this->getSmsCampaignWithHttpInfo($campaignId, $getSmsCampaign); + return $response; + } + + /** + * Operation getSmsCampaignWithHttpInfo + * + * Get an SMS campaign + * + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\GetSmsCampaign $getSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetSmsCampaign, HTTP status code, HTTP response headers (array of strings) + */ + public function getSmsCampaignWithHttpInfo($campaignId, $getSmsCampaign) + { + $returnType = '\SendinBlue\Client\Model\GetSmsCampaign'; + $request = $this->getSmsCampaignRequest($campaignId, $getSmsCampaign); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/smsCampaigns/{campaignId}' - ); + $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() + ]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetSmsCampaign', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getSmsCampaign + * Operation getSmsCampaignAsync * * Get an SMS campaign * - * @param int $campaignId id of the SMS campaign (required) - * @param \SendinBlue\Client\Model\GetSmsCampaign $getSmsCampaign Values to update an SMS Campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetSmsCampaign + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\GetSmsCampaign $getSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getSmsCampaign($campaignId, $getSmsCampaign) + public function getSmsCampaignAsync($campaignId, $getSmsCampaign) { - list($response) = $this->getSmsCampaignWithHttpInfo($campaignId, $getSmsCampaign); - return $response; + return $this->getSmsCampaignAsyncWithHttpInfo($campaignId, $getSmsCampaign) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getSmsCampaignWithHttpInfo + * Operation getSmsCampaignAsyncWithHttpInfo * * Get an SMS campaign * - * @param int $campaignId id of the SMS campaign (required) - * @param \SendinBlue\Client\Model\GetSmsCampaign $getSmsCampaign Values to update an SMS Campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetSmsCampaign, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\GetSmsCampaign $getSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getSmsCampaignWithHttpInfo($campaignId, $getSmsCampaign) + public function getSmsCampaignAsyncWithHttpInfo($campaignId, $getSmsCampaign) + { + $returnType = '\SendinBlue\Client\Model\GetSmsCampaign'; + $request = $this->getSmsCampaignRequest($campaignId, $getSmsCampaign); + + 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 'getSmsCampaign' + * + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\GetSmsCampaign $getSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSmsCampaignRequest($campaignId, $getSmsCampaign) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling getSmsCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling getSmsCampaign' + ); } // verify the required parameter 'getSmsCampaign' is set if ($getSmsCampaign === null) { - throw new \InvalidArgumentException('Missing the required parameter $getSmsCampaign when calling getSmsCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $getSmsCampaign when calling getSmsCampaign' + ); } - // parse inputs - $resourcePath = "/smsCampaigns/{campaignId}"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns/{campaignId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($getSmsCampaign)) { $_tempBody = $getSmsCampaign; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetSmsCampaign', - '/smsCampaigns/{campaignId}' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetSmsCampaign', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetSmsCampaign', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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 + ); } /** @@ -377,10 +900,12 @@ public function getSmsCampaignWithHttpInfo($campaignId, $getSmsCampaign) * * Returns the informations for all your created SMS campaigns * - * @param string $status Status of campaign. (optional) - * @param int $limit Number limitation for the result returned (optional, default to 500) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string $status Status of campaign. (optional) + * @param int $limit Number limitation for the result returned (optional, default to 500) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetSmsCampaigns */ public function getSmsCampaigns($status = null, $limit = '500', $offset = '0') @@ -394,81 +919,267 @@ public function getSmsCampaigns($status = null, $limit = '500', $offset = '0') * * Returns the informations for all your created SMS campaigns * - * @param string $status Status of campaign. (optional) - * @param int $limit Number limitation for the result returned (optional, default to 500) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param string $status Status of campaign. (optional) + * @param int $limit Number limitation for the result returned (optional, default to 500) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetSmsCampaigns, HTTP status code, HTTP response headers (array of strings) */ public function getSmsCampaignsWithHttpInfo($status = null, $limit = '500', $offset = '0') { - if (!is_null($limit) && ($limit > 1000)) { + $returnType = '\SendinBlue\Client\Model\GetSmsCampaigns'; + $request = $this->getSmsCampaignsRequest($status, $limit, $offset); + + 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\GetSmsCampaigns', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSmsCampaignsAsync + * + * Returns the informations for all your created SMS campaigns + * + * @param string $status Status of campaign. (optional) + * @param int $limit Number limitation for the result returned (optional, default to 500) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmsCampaignsAsync($status = null, $limit = '500', $offset = '0') + { + return $this->getSmsCampaignsAsyncWithHttpInfo($status, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSmsCampaignsAsyncWithHttpInfo + * + * Returns the informations for all your created SMS campaigns + * + * @param string $status Status of campaign. (optional) + * @param int $limit Number limitation for the result returned (optional, default to 500) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmsCampaignsAsyncWithHttpInfo($status = null, $limit = '500', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetSmsCampaigns'; + $request = $this->getSmsCampaignsRequest($status, $limit, $offset); + + 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 'getSmsCampaigns' + * + * @param string $status Status of campaign. (optional) + * @param int $limit Number limitation for the result returned (optional, default to 500) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSmsCampaignsRequest($status = null, $limit = '500', $offset = '0') + { + if ($limit !== null && $limit > 1000) { throw new \InvalidArgumentException('invalid value for "$limit" when calling SMSCampaignsApi.getSmsCampaigns, must be smaller than or equal to 1000.'); } - // parse inputs - $resourcePath = "/smsCampaigns"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($status !== null) { - $queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status); + $queryParams['status'] = ObjectSerializer::toQueryValue($status); } // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetSmsCampaigns', - '/smsCampaigns' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetSmsCampaigns', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetSmsCampaigns', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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 + ); } /** @@ -476,9 +1187,11 @@ public function getSmsCampaignsWithHttpInfo($status = null, $limit = '500', $off * * Exports the recipients of the specified campaign. * - * @param int $campaignId id of the campaign (required) - * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreatedProcessId */ public function requestSmsRecipientExport($campaignId, $recipientExport = null) @@ -492,587 +1205,1584 @@ public function requestSmsRecipientExport($campaignId, $recipientExport = null) * * Exports the recipients of the specified campaign. * - * @param int $campaignId id of the campaign (required) - * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreatedProcessId, HTTP status code, HTTP response headers (array of strings) */ public function requestSmsRecipientExportWithHttpInfo($campaignId, $recipientExport = null) + { + $returnType = '\SendinBlue\Client\Model\CreatedProcessId'; + $request = $this->requestSmsRecipientExportRequest($campaignId, $recipientExport); + + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreatedProcessId', + $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 requestSmsRecipientExportAsync + * + * Exports the recipients of the specified campaign. + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function requestSmsRecipientExportAsync($campaignId, $recipientExport = null) + { + return $this->requestSmsRecipientExportAsyncWithHttpInfo($campaignId, $recipientExport) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation requestSmsRecipientExportAsyncWithHttpInfo + * + * Exports the recipients of the specified campaign. + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function requestSmsRecipientExportAsyncWithHttpInfo($campaignId, $recipientExport = null) + { + $returnType = '\SendinBlue\Client\Model\CreatedProcessId'; + $request = $this->requestSmsRecipientExportRequest($campaignId, $recipientExport); + + 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 'requestSmsRecipientExport' + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\RequestSmsRecipientExport $recipientExport Values to send for a recipient export request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function requestSmsRecipientExportRequest($campaignId, $recipientExport = null) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling requestSmsRecipientExport'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling requestSmsRecipientExport' + ); } - // parse inputs - $resourcePath = "/smsCampaigns/{campaignId}/exportRecipients"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns/{campaignId}/exportRecipients'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($recipientExport)) { $_tempBody = $recipientExport; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendSmsCampaignNow + * + * Send your SMS campaign immediately + * + * @param int $campaignId id of the campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendSmsCampaignNow($campaignId) + { + $this->sendSmsCampaignNowWithHttpInfo($campaignId); + } + + /** + * Operation sendSmsCampaignNowWithHttpInfo + * + * Send your SMS campaign immediately + * + * @param int $campaignId id of the campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendSmsCampaignNowWithHttpInfo($campaignId) + { + $returnType = ''; + $request = $this->sendSmsCampaignNowRequest($campaignId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreatedProcessId', - '/smsCampaigns/{campaignId}/exportRecipients' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreatedProcessId', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 202: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreatedProcessId', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation sendSmsCampaignNow + * Operation sendSmsCampaignNowAsync * * Send your SMS campaign immediately * - * @param int $campaignId id of the campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendSmsCampaignNow($campaignId) + public function sendSmsCampaignNowAsync($campaignId) { - list($response) = $this->sendSmsCampaignNowWithHttpInfo($campaignId); - return $response; + return $this->sendSmsCampaignNowAsyncWithHttpInfo($campaignId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation sendSmsCampaignNowWithHttpInfo + * Operation sendSmsCampaignNowAsyncWithHttpInfo * * Send your SMS campaign immediately * - * @param int $campaignId id of the campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendSmsCampaignNowWithHttpInfo($campaignId) + public function sendSmsCampaignNowAsyncWithHttpInfo($campaignId) + { + $returnType = ''; + $request = $this->sendSmsCampaignNowRequest($campaignId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'sendSmsCampaignNow' + * + * @param int $campaignId id of the campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendSmsCampaignNowRequest($campaignId) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling sendSmsCampaignNow'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling sendSmsCampaignNow' + ); } - // parse inputs - $resourcePath = "/smsCampaigns/{campaignId}/sendNow"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns/{campaignId}/sendNow'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . '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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendSmsReport + * + * Send report of SMS campaigns + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendSmsReport($campaignId, $sendReport) + { + $this->sendSmsReportWithHttpInfo($campaignId, $sendReport); + } + + /** + * Operation sendSmsReportWithHttpInfo + * + * Send report of SMS campaigns + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendSmsReportWithHttpInfo($campaignId, $sendReport) + { + $returnType = ''; + $request = $this->sendSmsReportRequest($campaignId, $sendReport); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/smsCampaigns/{campaignId}/sendNow' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 402: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation sendSmsReport + * Operation sendSmsReportAsync * * Send report of SMS campaigns * - * @param int $campaignId id of the campaign (required) - * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendSmsReport($campaignId, $sendReport) + public function sendSmsReportAsync($campaignId, $sendReport) { - list($response) = $this->sendSmsReportWithHttpInfo($campaignId, $sendReport); - return $response; + return $this->sendSmsReportAsyncWithHttpInfo($campaignId, $sendReport) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation sendSmsReportWithHttpInfo + * Operation sendSmsReportAsyncWithHttpInfo * * Send report of SMS campaigns * - * @param int $campaignId id of the campaign (required) - * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendSmsReportWithHttpInfo($campaignId, $sendReport) + public function sendSmsReportAsyncWithHttpInfo($campaignId, $sendReport) + { + $returnType = ''; + $request = $this->sendSmsReportRequest($campaignId, $sendReport); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'sendSmsReport' + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\SendReport $sendReport Values for send a report (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendSmsReportRequest($campaignId, $sendReport) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling sendSmsReport'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling sendSmsReport' + ); } // verify the required parameter 'sendReport' is set if ($sendReport === null) { - throw new \InvalidArgumentException('Missing the required parameter $sendReport when calling sendSmsReport'); + throw new \InvalidArgumentException( + 'Missing the required parameter $sendReport when calling sendSmsReport' + ); } - // parse inputs - $resourcePath = "/smsCampaigns/{campaignId}/sendReport"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns/{campaignId}/sendReport'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($sendReport)) { $_tempBody = $sendReport; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendTestSms + * + * Send an SMS + * + * @param int $campaignId Id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\SendTestSms $sendTestSms Mobile number to which send the test (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendTestSms($campaignId, $sendTestSms) + { + $this->sendTestSmsWithHttpInfo($campaignId, $sendTestSms); + } + + /** + * Operation sendTestSmsWithHttpInfo + * + * Send an SMS + * + * @param int $campaignId Id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\SendTestSms $sendTestSms Mobile number to which send the test (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendTestSmsWithHttpInfo($campaignId, $sendTestSms) + { + $returnType = ''; + $request = $this->sendTestSmsRequest($campaignId, $sendTestSms); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/smsCampaigns/{campaignId}/sendReport' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\PostSendSmsTestFailed', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation sendTestSms + * Operation sendTestSmsAsync * * Send an SMS * - * @param int $campaignId Id of the SMS campaign (required) - * @param \SendinBlue\Client\Model\SendTestSms $sendTestSms Mobile number to which send the test (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId Id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\SendTestSms $sendTestSms Mobile number to which send the test (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendTestSms($campaignId, $sendTestSms) + public function sendTestSmsAsync($campaignId, $sendTestSms) { - list($response) = $this->sendTestSmsWithHttpInfo($campaignId, $sendTestSms); - return $response; + return $this->sendTestSmsAsyncWithHttpInfo($campaignId, $sendTestSms) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation sendTestSmsWithHttpInfo + * Operation sendTestSmsAsyncWithHttpInfo * * Send an SMS * - * @param int $campaignId Id of the SMS campaign (required) - * @param \SendinBlue\Client\Model\SendTestSms $sendTestSms Mobile number to which send the test (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId Id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\SendTestSms $sendTestSms Mobile number to which send the test (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendTestSmsWithHttpInfo($campaignId, $sendTestSms) + public function sendTestSmsAsyncWithHttpInfo($campaignId, $sendTestSms) + { + $returnType = ''; + $request = $this->sendTestSmsRequest($campaignId, $sendTestSms); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'sendTestSms' + * + * @param int $campaignId Id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\SendTestSms $sendTestSms Mobile number to which send the test (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendTestSmsRequest($campaignId, $sendTestSms) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling sendTestSms'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling sendTestSms' + ); } // verify the required parameter 'sendTestSms' is set if ($sendTestSms === null) { - throw new \InvalidArgumentException('Missing the required parameter $sendTestSms when calling sendTestSms'); + throw new \InvalidArgumentException( + 'Missing the required parameter $sendTestSms when calling sendTestSms' + ); } - // parse inputs - $resourcePath = "/smsCampaigns/{campaignId}/sendTest"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns/{campaignId}/sendTest'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($sendTestSms)) { $_tempBody = $sendTestSms; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateSmsCampaign + * + * Updates an SMS campaign + * + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateSmsCampaign($campaignId, $updateSmsCampaign) + { + $this->updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign); + } + + /** + * Operation updateSmsCampaignWithHttpInfo + * + * Updates an SMS campaign + * + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign) + { + $returnType = ''; + $request = $this->updateSmsCampaignRequest($campaignId, $updateSmsCampaign); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/smsCampaigns/{campaignId}/sendTest' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostSendSmsTestFailed', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateSmsCampaign + * Operation updateSmsCampaignAsync * * Updates an SMS campaign * - * @param int $campaignId id of the SMS campaign (required) - * @param \SendinBlue\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSmsCampaign($campaignId, $updateSmsCampaign) + public function updateSmsCampaignAsync($campaignId, $updateSmsCampaign) { - list($response) = $this->updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign); - return $response; + return $this->updateSmsCampaignAsyncWithHttpInfo($campaignId, $updateSmsCampaign) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateSmsCampaignWithHttpInfo + * Operation updateSmsCampaignAsyncWithHttpInfo * * Updates an SMS campaign * - * @param int $campaignId id of the SMS campaign (required) - * @param \SendinBlue\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSmsCampaignWithHttpInfo($campaignId, $updateSmsCampaign) + public function updateSmsCampaignAsyncWithHttpInfo($campaignId, $updateSmsCampaign) + { + $returnType = ''; + $request = $this->updateSmsCampaignRequest($campaignId, $updateSmsCampaign); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateSmsCampaign' + * + * @param int $campaignId id of the SMS campaign (required) + * @param \SendinBlue\Client\Model\UpdateSmsCampaign $updateSmsCampaign Values to update an SMS Campaign (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateSmsCampaignRequest($campaignId, $updateSmsCampaign) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling updateSmsCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateSmsCampaign' + ); } // verify the required parameter 'updateSmsCampaign' is set if ($updateSmsCampaign === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateSmsCampaign when calling updateSmsCampaign'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateSmsCampaign when calling updateSmsCampaign' + ); } - // parse inputs - $resourcePath = "/smsCampaigns/{campaignId}"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns/{campaignId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateSmsCampaign)) { $_tempBody = $updateSmsCampaign; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateSmsCampaignStatus + * + * Update the campaign status + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateSmsCampaignStatus($campaignId, $status) + { + $this->updateSmsCampaignStatusWithHttpInfo($campaignId, $status); + } + + /** + * Operation updateSmsCampaignStatusWithHttpInfo + * + * Update the campaign status + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateSmsCampaignStatusWithHttpInfo($campaignId, $status) + { + $returnType = ''; + $request = $this->updateSmsCampaignStatusRequest($campaignId, $status); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/smsCampaigns/{campaignId}' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateSmsCampaignStatus + * Operation updateSmsCampaignStatusAsync * * Update the campaign status * - * @param int $campaignId id of the campaign (required) - * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSmsCampaignStatus($campaignId, $status) + public function updateSmsCampaignStatusAsync($campaignId, $status) { - list($response) = $this->updateSmsCampaignStatusWithHttpInfo($campaignId, $status); - return $response; + return $this->updateSmsCampaignStatusAsyncWithHttpInfo($campaignId, $status) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateSmsCampaignStatusWithHttpInfo + * Operation updateSmsCampaignStatusAsyncWithHttpInfo * * Update the campaign status * - * @param int $campaignId id of the campaign (required) - * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSmsCampaignStatusWithHttpInfo($campaignId, $status) + public function updateSmsCampaignStatusAsyncWithHttpInfo($campaignId, $status) + { + $returnType = ''; + $request = $this->updateSmsCampaignStatusRequest($campaignId, $status); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateSmsCampaignStatus' + * + * @param int $campaignId id of the campaign (required) + * @param \SendinBlue\Client\Model\UpdateCampaignStatus $status Status of the campaign. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateSmsCampaignStatusRequest($campaignId, $status) { // verify the required parameter 'campaignId' is set if ($campaignId === null) { - throw new \InvalidArgumentException('Missing the required parameter $campaignId when calling updateSmsCampaignStatus'); + throw new \InvalidArgumentException( + 'Missing the required parameter $campaignId when calling updateSmsCampaignStatus' + ); } // verify the required parameter 'status' is set if ($status === null) { - throw new \InvalidArgumentException('Missing the required parameter $status when calling updateSmsCampaignStatus'); + throw new \InvalidArgumentException( + 'Missing the required parameter $status when calling updateSmsCampaignStatus' + ); } - // parse inputs - $resourcePath = "/smsCampaigns/{campaignId}/status"; - $httpBody = ''; + + $resourcePath = '/smsCampaigns/{campaignId}/status'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($campaignId !== null) { $resourcePath = str_replace( - "{" . "campaignId" . "}", - $this->apiClient->getSerializer()->toPathValue($campaignId), + '{' . 'campaignId' . '}', + ObjectSerializer::toPathValue($campaignId), $resourcePath ); } + // body params $_tempBody = null; if (isset($status)) { $_tempBody = $status; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/smsCampaigns/{campaignId}/status' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/SMTPApi.php b/lib/Api/SMTPApi.php index 56c1245b..8ca695c7 100644 --- a/lib/Api/SMTPApi.php +++ b/lib/Api/SMTPApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * SMTPApi Class Doc Comment @@ -44,47 +50,36 @@ class SMTPApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return SMTPApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,8 +87,10 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Create an smtp template * - * @param \SendinBlue\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * @param \SendinBlue\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateModel */ public function createSmtpTemplate($smtpTemplate) @@ -107,27 +104,181 @@ public function createSmtpTemplate($smtpTemplate) * * Create an smtp template * - * @param \SendinBlue\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * @param \SendinBlue\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) */ public function createSmtpTemplateWithHttpInfo($smtpTemplate) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createSmtpTemplateRequest($smtpTemplate); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createSmtpTemplateAsync + * + * Create an smtp template + * + * @param \SendinBlue\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSmtpTemplateAsync($smtpTemplate) + { + return $this->createSmtpTemplateAsyncWithHttpInfo($smtpTemplate) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSmtpTemplateAsyncWithHttpInfo + * + * Create an smtp template + * + * @param \SendinBlue\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSmtpTemplateAsyncWithHttpInfo($smtpTemplate) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createSmtpTemplateRequest($smtpTemplate); + + 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 'createSmtpTemplate' + * + * @param \SendinBlue\Client\Model\CreateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createSmtpTemplateRequest($smtpTemplate) { // verify the required parameter 'smtpTemplate' is set if ($smtpTemplate === null) { - throw new \InvalidArgumentException('Missing the required parameter $smtpTemplate when calling createSmtpTemplate'); + throw new \InvalidArgumentException( + 'Missing the required parameter $smtpTemplate when calling createSmtpTemplate' + ); } - // parse inputs - $resourcePath = "/smtp/templates"; - $httpBody = ''; + + $resourcePath = '/smtp/templates'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -135,44 +286,70 @@ public function createSmtpTemplateWithHttpInfo($smtpTemplate) $_tempBody = $smtpTemplate; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/smtp/templates' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -180,14 +357,15 @@ public function createSmtpTemplateWithHttpInfo($smtpTemplate) * * Delete hardbounces * - * @param \SendinBlue\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * @param \SendinBlue\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ public function deleteHardbounces($deleteHardbounces = null) { - list($response) = $this->deleteHardbouncesWithHttpInfo($deleteHardbounces); - return $response; + $this->deleteHardbouncesWithHttpInfo($deleteHardbounces); } /** @@ -195,23 +373,139 @@ public function deleteHardbounces($deleteHardbounces = null) * * Delete hardbounces * - * @param \SendinBlue\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * @param \SendinBlue\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteHardbouncesWithHttpInfo($deleteHardbounces = null) { - // parse inputs - $resourcePath = "/smtp/deleteHardbounces"; - $httpBody = ''; + $returnType = ''; + $request = $this->deleteHardbouncesRequest($deleteHardbounces); + + 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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteHardbouncesAsync + * + * Delete hardbounces + * + * @param \SendinBlue\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteHardbouncesAsync($deleteHardbounces = null) + { + return $this->deleteHardbouncesAsyncWithHttpInfo($deleteHardbounces) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteHardbouncesAsyncWithHttpInfo + * + * Delete hardbounces + * + * @param \SendinBlue\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteHardbouncesAsyncWithHttpInfo($deleteHardbounces = null) + { + $returnType = ''; + $request = $this->deleteHardbouncesRequest($deleteHardbounces); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteHardbounces' + * + * @param \SendinBlue\Client\Model\DeleteHardbounces $deleteHardbounces values to delete hardbounces (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteHardbouncesRequest($deleteHardbounces = null) + { + + $resourcePath = '/smtp/deleteHardbounces'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -219,40 +513,70 @@ public function deleteHardbouncesWithHttpInfo($deleteHardbounces = null) $_tempBody = $deleteHardbounces; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/smtp/deleteHardbounces' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -260,14 +584,15 @@ public function deleteHardbouncesWithHttpInfo($deleteHardbounces = null) * * Delete an inactive smtp template * - * @param int $templateId id of the template (required) + * @param int $templateId id of the template (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return void */ public function deleteSmtpTemplate($templateId) { - list($response) = $this->deleteSmtpTemplateWithHttpInfo($templateId); - return $response; + $this->deleteSmtpTemplateWithHttpInfo($templateId); } /** @@ -275,75 +600,229 @@ public function deleteSmtpTemplate($templateId) * * Delete an inactive smtp template * - * @param int $templateId id of the template (required) + * @param int $templateId id of the template (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function deleteSmtpTemplateWithHttpInfo($templateId) + { + $returnType = ''; + $request = $this->deleteSmtpTemplateRequest($templateId); + + 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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + 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 deleteSmtpTemplateAsync + * + * Delete an inactive smtp template + * + * @param int $templateId id of the template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSmtpTemplateAsync($templateId) + { + return $this->deleteSmtpTemplateAsyncWithHttpInfo($templateId) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteSmtpTemplateAsyncWithHttpInfo + * + * Delete an inactive smtp template + * + * @param int $templateId id of the template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteSmtpTemplateAsyncWithHttpInfo($templateId) + { + $returnType = ''; + $request = $this->deleteSmtpTemplateRequest($templateId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteSmtpTemplate' + * + * @param int $templateId id of the template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteSmtpTemplateRequest($templateId) { // verify the required parameter 'templateId' is set if ($templateId === null) { - throw new \InvalidArgumentException('Missing the required parameter $templateId when calling deleteSmtpTemplate'); + throw new \InvalidArgumentException( + 'Missing the required parameter $templateId when calling deleteSmtpTemplate' + ); } - // parse inputs - $resourcePath = "/smtp/templates/{templateId}"; - $httpBody = ''; + + $resourcePath = '/smtp/templates/{templateId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( - "{" . "templateId" . "}", - $this->apiClient->getSerializer()->toPathValue($templateId), + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($templateId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/smtp/templates/{templateId}' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -351,11 +830,13 @@ public function deleteSmtpTemplateWithHttpInfo($templateId) * * Get your SMTP activity aggregated over a period of time * - * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $tag Tag of the emails (optional) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetAggregatedReport */ public function getAggregatedSmtpReport($startDate = null, $endDate = null, $days = null, $tag = null) @@ -369,340 +850,935 @@ public function getAggregatedSmtpReport($startDate = null, $endDate = null, $day * * Get your SMTP activity aggregated over a period of time * - * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $tag Tag of the emails (optional) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetAggregatedReport, HTTP status code, HTTP response headers (array of strings) */ public function getAggregatedSmtpReportWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) { - // parse inputs - $resourcePath = "/smtp/statistics/aggregatedReport"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $returnType = '\SendinBlue\Client\Model\GetAggregatedReport'; + $request = $this->getAggregatedSmtpReportRequest($startDate, $endDate, $days, $tag); - // query params - if ($startDate !== null) { - $queryParams['startDate'] = $this->apiClient->getSerializer()->toQueryValue($startDate); - } - // query params - if ($endDate !== null) { - $queryParams['endDate'] = $this->apiClient->getSerializer()->toQueryValue($endDate); + 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\GetAggregatedReport', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getAggregatedSmtpReportAsync + * + * Get your SMTP activity aggregated over a period of time + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAggregatedSmtpReportAsync($startDate = null, $endDate = null, $days = null, $tag = null) + { + return $this->getAggregatedSmtpReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAggregatedSmtpReportAsyncWithHttpInfo + * + * Get your SMTP activity aggregated over a period of time + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getAggregatedSmtpReportAsyncWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + { + $returnType = '\SendinBlue\Client\Model\GetAggregatedReport'; + $request = $this->getAggregatedSmtpReportRequest($startDate, $endDate, $days, $tag); + + 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 'getAggregatedSmtpReport' + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getAggregatedSmtpReportRequest($startDate = null, $endDate = null, $days = null, $tag = null) + { + + $resourcePath = '/smtp/statistics/aggregatedReport'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($startDate !== null) { + $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); + } + // query params + if ($endDate !== null) { + $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); } // query params if ($days !== null) { - $queryParams['days'] = $this->apiClient->getSerializer()->toQueryValue($days); + $queryParams['days'] = ObjectSerializer::toQueryValue($days); } // query params if ($tag !== null) { - $queryParams['tag'] = $this->apiClient->getSerializer()->toQueryValue($tag); + $queryParams['tag'] = ObjectSerializer::toQueryValue($tag); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 getEmailEventReport + * + * Get all your SMTP activity (unaggregated events) + * + * @param int $limit Number limitation for the result returned (optional, default to 50) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $email Filter the report for a specific email addresses (optional) + * @param string $event Filter the report for a specific event type (optional) + * @param string $tags Filter the report for tags (serialized and urlencoded array) (optional) + * @param string $messageId Filter on a specific message id (optional) + * @param int $templateId Filter on a specific template id (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetEmailEventReport + */ + public function getEmailEventReport($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null) + { + list($response) = $this->getEmailEventReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId); + return $response; + } + + /** + * Operation getEmailEventReportWithHttpInfo + * + * Get all your SMTP activity (unaggregated events) + * + * @param int $limit Number limitation for the result returned (optional, default to 50) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $email Filter the report for a specific email addresses (optional) + * @param string $event Filter the report for a specific event type (optional) + * @param string $tags Filter the report for tags (serialized and urlencoded array) (optional) + * @param string $messageId Filter on a specific message id (optional) + * @param int $templateId Filter on a specific template id (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetEmailEventReport, HTTP status code, HTTP response headers (array of strings) + */ + public function getEmailEventReportWithHttpInfo($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null) + { + $returnType = '\SendinBlue\Client\Model\GetEmailEventReport'; + $request = $this->getEmailEventReportRequest($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetAggregatedReport', - '/smtp/statistics/aggregatedReport' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetAggregatedReport', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetAggregatedReport', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetEmailEventReport', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getEmailEventReport + * Operation getEmailEventReportAsync * * Get all your SMTP activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 50) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $email Filter the report for a specific email addresses (optional) - * @param string $event Filter the report for a specific event type (optional) - * @param string $tags Filter the report for tags (serialized and urlencoded array) (optional) - * @param string $messageId Filter on a specific message id (optional) - * @param int $templateId Filter on a specific template id (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetEmailEventReport + * @param int $limit Number limitation for the result returned (optional, default to 50) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $email Filter the report for a specific email addresses (optional) + * @param string $event Filter the report for a specific event type (optional) + * @param string $tags Filter the report for tags (serialized and urlencoded array) (optional) + * @param string $messageId Filter on a specific message id (optional) + * @param int $templateId Filter on a specific template id (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getEmailEventReport($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null) + public function getEmailEventReportAsync($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null) { - list($response) = $this->getEmailEventReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId); - return $response; + return $this->getEmailEventReportAsyncWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getEmailEventReportWithHttpInfo + * Operation getEmailEventReportAsyncWithHttpInfo * * Get all your SMTP activity (unaggregated events) * - * @param int $limit Number limitation for the result returned (optional, default to 50) - * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $email Filter the report for a specific email addresses (optional) - * @param string $event Filter the report for a specific event type (optional) - * @param string $tags Filter the report for tags (serialized and urlencoded array) (optional) - * @param string $messageId Filter on a specific message id (optional) - * @param int $templateId Filter on a specific template id (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetEmailEventReport, HTTP status code, HTTP response headers (array of strings) + * @param int $limit Number limitation for the result returned (optional, default to 50) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $email Filter the report for a specific email addresses (optional) + * @param string $event Filter the report for a specific event type (optional) + * @param string $tags Filter the report for tags (serialized and urlencoded array) (optional) + * @param string $messageId Filter on a specific message id (optional) + * @param int $templateId Filter on a specific template id (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getEmailEventReportWithHttpInfo($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null) + public function getEmailEventReportAsyncWithHttpInfo($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null) + { + $returnType = '\SendinBlue\Client\Model\GetEmailEventReport'; + $request = $this->getEmailEventReportRequest($limit, $offset, $startDate, $endDate, $days, $email, $event, $tags, $messageId, $templateId); + + 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 'getEmailEventReport' + * + * @param int $limit Number limitation for the result returned (optional, default to 50) + * @param int $offset Beginning point in the list to retrieve from. (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $email Filter the report for a specific email addresses (optional) + * @param string $event Filter the report for a specific event type (optional) + * @param string $tags Filter the report for tags (serialized and urlencoded array) (optional) + * @param string $messageId Filter on a specific message id (optional) + * @param int $templateId Filter on a specific template id (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getEmailEventReportRequest($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $email = null, $event = null, $tags = null, $messageId = null, $templateId = null) { - if (!is_null($limit) && ($limit > 100)) { + if ($limit !== null && $limit > 100) { throw new \InvalidArgumentException('invalid value for "$limit" when calling SMTPApi.getEmailEventReport, must be smaller than or equal to 100.'); } - // parse inputs - $resourcePath = "/smtp/statistics/events"; - $httpBody = ''; + + $resourcePath = '/smtp/statistics/events'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } // query params if ($startDate !== null) { - $queryParams['startDate'] = $this->apiClient->getSerializer()->toQueryValue($startDate); + $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); } // query params if ($endDate !== null) { - $queryParams['endDate'] = $this->apiClient->getSerializer()->toQueryValue($endDate); + $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); } // query params if ($days !== null) { - $queryParams['days'] = $this->apiClient->getSerializer()->toQueryValue($days); + $queryParams['days'] = ObjectSerializer::toQueryValue($days); } // query params if ($email !== null) { - $queryParams['email'] = $this->apiClient->getSerializer()->toQueryValue($email); + $queryParams['email'] = ObjectSerializer::toQueryValue($email); } // query params if ($event !== null) { - $queryParams['event'] = $this->apiClient->getSerializer()->toQueryValue($event); + $queryParams['event'] = ObjectSerializer::toQueryValue($event); } // query params if ($tags !== null) { - $queryParams['tags'] = $this->apiClient->getSerializer()->toQueryValue($tags); + $queryParams['tags'] = ObjectSerializer::toQueryValue($tags); } // query params if ($messageId !== null) { - $queryParams['messageId'] = $this->apiClient->getSerializer()->toQueryValue($messageId); + $queryParams['messageId'] = ObjectSerializer::toQueryValue($messageId); } // query params if ($templateId !== null) { - $queryParams['templateId'] = $this->apiClient->getSerializer()->toQueryValue($templateId); + $queryParams['templateId'] = ObjectSerializer::toQueryValue($templateId); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getSmtpReport + * + * Get your SMTP activity aggregated per day + * + * @param int $limit Number of documents returned per page (optional, default to 50) + * @param int $offset Index of the first document on the page (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetReports + */ + public function getSmtpReport($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null) + { + list($response) = $this->getSmtpReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $tag); + return $response; + } + + /** + * Operation getSmtpReportWithHttpInfo + * + * Get your SMTP activity aggregated per day + * + * @param int $limit Number of documents returned per page (optional, default to 50) + * @param int $offset Index of the first document on the page (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetReports, HTTP status code, HTTP response headers (array of strings) + */ + public function getSmtpReportWithHttpInfo($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null) + { + $returnType = '\SendinBlue\Client\Model\GetReports'; + $request = $this->getSmtpReportRequest($limit, $offset, $startDate, $endDate, $days, $tag); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetEmailEventReport', - '/smtp/statistics/events' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetEmailEventReport', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetEmailEventReport', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetReports', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getSmtpReport + * Operation getSmtpReportAsync * * Get your SMTP activity aggregated per day * - * @param int $limit Number of documents returned per page (optional, default to 50) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $tag Tag of the emails (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetReports + * @param int $limit Number of documents returned per page (optional, default to 50) + * @param int $offset Index of the first document on the page (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getSmtpReport($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null) + public function getSmtpReportAsync($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null) { - list($response) = $this->getSmtpReportWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $tag); - return $response; + return $this->getSmtpReportAsyncWithHttpInfo($limit, $offset, $startDate, $endDate, $days, $tag) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getSmtpReportWithHttpInfo + * Operation getSmtpReportAsyncWithHttpInfo * * Get your SMTP activity aggregated per day * - * @param int $limit Number of documents returned per page (optional, default to 50) - * @param int $offset Index of the first document on the page (optional, default to 0) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $tag Tag of the emails (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetReports, HTTP status code, HTTP response headers (array of strings) + * @param int $limit Number of documents returned per page (optional, default to 50) + * @param int $offset Index of the first document on the page (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getSmtpReportWithHttpInfo($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null) + public function getSmtpReportAsyncWithHttpInfo($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null) + { + $returnType = '\SendinBlue\Client\Model\GetReports'; + $request = $this->getSmtpReportRequest($limit, $offset, $startDate, $endDate, $days, $tag); + + 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 'getSmtpReport' + * + * @param int $limit Number of documents returned per page (optional, default to 50) + * @param int $offset Index of the first document on the page (optional, default to 0) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Tag of the emails (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSmtpReportRequest($limit = '50', $offset = '0', $startDate = null, $endDate = null, $days = null, $tag = null) { - if (!is_null($limit) && ($limit > 100)) { + if ($limit !== null && $limit > 100) { throw new \InvalidArgumentException('invalid value for "$limit" when calling SMTPApi.getSmtpReport, must be smaller than or equal to 100.'); } - // parse inputs - $resourcePath = "/smtp/statistics/reports"; - $httpBody = ''; + + $resourcePath = '/smtp/statistics/reports'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } // query params if ($startDate !== null) { - $queryParams['startDate'] = $this->apiClient->getSerializer()->toQueryValue($startDate); + $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); } // query params if ($endDate !== null) { - $queryParams['endDate'] = $this->apiClient->getSerializer()->toQueryValue($endDate); + $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); } // query params if ($days !== null) { - $queryParams['days'] = $this->apiClient->getSerializer()->toQueryValue($days); + $queryParams['days'] = ObjectSerializer::toQueryValue($days); } // query params if ($tag !== null) { - $queryParams['tag'] = $this->apiClient->getSerializer()->toQueryValue($tag); + $queryParams['tag'] = ObjectSerializer::toQueryValue($tag); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetReports', - '/smtp/statistics/reports' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetReports', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetReports', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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 + ); } /** @@ -710,8 +1786,10 @@ public function getSmtpReportWithHttpInfo($limit = '50', $offset = '0', $startDa * * Returns the template informations * - * @param int $templateId id of the template (required) + * @param int $templateId id of the template (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetSmtpTemplateOverview */ public function getSmtpTemplate($templateId) @@ -725,90 +1803,278 @@ public function getSmtpTemplate($templateId) * * Returns the template informations * - * @param int $templateId id of the template (required) + * @param int $templateId id of the template (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetSmtpTemplateOverview, HTTP status code, HTTP response headers (array of strings) */ public function getSmtpTemplateWithHttpInfo($templateId) { - // verify the required parameter 'templateId' is set - if ($templateId === null) { - throw new \InvalidArgumentException('Missing the required parameter $templateId when calling getSmtpTemplate'); - } - // parse inputs - $resourcePath = "/smtp/templates/{templateId}"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $returnType = '\SendinBlue\Client\Model\GetSmtpTemplateOverview'; + $request = $this->getSmtpTemplateRequest($templateId); - // path params - if ($templateId !== null) { - $resourcePath = str_replace( - "{" . "templateId" . "}", - $this->apiClient->getSerializer()->toPathValue($templateId), - $resourcePath - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetSmtpTemplateOverview', - '/smtp/templates/{templateId}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetSmtpTemplateOverview', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetSmtpTemplateOverview', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetSmtpTemplateOverview', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } + /** + * Operation getSmtpTemplateAsync + * + * Returns the template informations + * + * @param int $templateId id of the template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmtpTemplateAsync($templateId) + { + return $this->getSmtpTemplateAsyncWithHttpInfo($templateId) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSmtpTemplateAsyncWithHttpInfo + * + * Returns the template informations + * + * @param int $templateId id of the template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmtpTemplateAsyncWithHttpInfo($templateId) + { + $returnType = '\SendinBlue\Client\Model\GetSmtpTemplateOverview'; + $request = $this->getSmtpTemplateRequest($templateId); + + 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 'getSmtpTemplate' + * + * @param int $templateId id of the template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSmtpTemplateRequest($templateId) + { + // verify the required parameter 'templateId' is set + if ($templateId === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $templateId when calling getSmtpTemplate' + ); + } + + $resourcePath = '/smtp/templates/{templateId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($templateId !== null) { + $resourcePath = str_replace( + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($templateId), + $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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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 getSmtpTemplates * * Get the list of SMTP templates * - * @param bool $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) - * @param int $limit Number of documents returned per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) + * @param bool $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int $limit Number of documents returned per page (optional, default to 50) + * @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\GetSmtpTemplates */ public function getSmtpTemplates($templateStatus = null, $limit = '50', $offset = '0') @@ -822,81 +2088,267 @@ public function getSmtpTemplates($templateStatus = null, $limit = '50', $offset * * Get the list of SMTP templates * - * @param bool $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) - * @param int $limit Number of documents returned per page (optional, default to 50) - * @param int $offset Index of the first document in the page (optional, default to 0) + * @param bool $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int $limit Number of documents returned per page (optional, default to 50) + * @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\GetSmtpTemplates, HTTP status code, HTTP response headers (array of strings) */ public function getSmtpTemplatesWithHttpInfo($templateStatus = null, $limit = '50', $offset = '0') { - if (!is_null($limit) && ($limit > 1000)) { + $returnType = '\SendinBlue\Client\Model\GetSmtpTemplates'; + $request = $this->getSmtpTemplatesRequest($templateStatus, $limit, $offset); + + 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\GetSmtpTemplates', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSmtpTemplatesAsync + * + * Get the list of SMTP templates + * + * @param bool $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int $limit Number of documents returned per page (optional, default to 50) + * @param int $offset Index of the first document in the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmtpTemplatesAsync($templateStatus = null, $limit = '50', $offset = '0') + { + return $this->getSmtpTemplatesAsyncWithHttpInfo($templateStatus, $limit, $offset) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSmtpTemplatesAsyncWithHttpInfo + * + * Get the list of SMTP templates + * + * @param bool $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int $limit Number of documents returned per page (optional, default to 50) + * @param int $offset Index of the first document in the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmtpTemplatesAsyncWithHttpInfo($templateStatus = null, $limit = '50', $offset = '0') + { + $returnType = '\SendinBlue\Client\Model\GetSmtpTemplates'; + $request = $this->getSmtpTemplatesRequest($templateStatus, $limit, $offset); + + 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 'getSmtpTemplates' + * + * @param bool $templateStatus Filter on the status of the template. Active = true, inactive = false (optional) + * @param int $limit Number of documents returned per page (optional, default to 50) + * @param int $offset Index of the first document in the page (optional, default to 0) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSmtpTemplatesRequest($templateStatus = null, $limit = '50', $offset = '0') + { + if ($limit !== null && $limit > 1000) { throw new \InvalidArgumentException('invalid value for "$limit" when calling SMTPApi.getSmtpTemplates, must be smaller than or equal to 1000.'); } - // parse inputs - $resourcePath = "/smtp/templates"; - $httpBody = ''; + + $resourcePath = '/smtp/templates'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($templateStatus !== null) { - $queryParams['templateStatus'] = $this->apiClient->getSerializer()->toQueryValue($templateStatus); + $queryParams['templateStatus'] = ObjectSerializer::toQueryValue($templateStatus); } // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetSmtpTemplates', - '/smtp/templates' - ); - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetSmtpTemplates', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetSmtpTemplates', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; + $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 + ); } /** @@ -904,9 +2356,11 @@ public function getSmtpTemplatesWithHttpInfo($templateStatus = null, $limit = '5 * * Send a template * - * @param int $templateId Id of the template (required) - * @param \SendinBlue\Client\Model\SendEmail $sendEmail (required) + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendEmail $sendEmail sendEmail (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\SendTemplateEmail */ public function sendTemplate($templateId, $sendEmail) @@ -920,191 +2374,538 @@ public function sendTemplate($templateId, $sendEmail) * * Send a template * - * @param int $templateId Id of the template (required) - * @param \SendinBlue\Client\Model\SendEmail $sendEmail (required) + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendEmail $sendEmail (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\SendTemplateEmail, HTTP status code, HTTP response headers (array of strings) */ public function sendTemplateWithHttpInfo($templateId, $sendEmail) + { + $returnType = '\SendinBlue\Client\Model\SendTemplateEmail'; + $request = $this->sendTemplateRequest($templateId, $sendEmail); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\SendTemplateEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\PostSendFailed', + $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 sendTemplateAsync + * + * Send a template + * + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendEmail $sendEmail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTemplateAsync($templateId, $sendEmail) + { + return $this->sendTemplateAsyncWithHttpInfo($templateId, $sendEmail) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendTemplateAsyncWithHttpInfo + * + * Send a template + * + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendEmail $sendEmail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTemplateAsyncWithHttpInfo($templateId, $sendEmail) + { + $returnType = '\SendinBlue\Client\Model\SendTemplateEmail'; + $request = $this->sendTemplateRequest($templateId, $sendEmail); + + 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 'sendTemplate' + * + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendEmail $sendEmail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendTemplateRequest($templateId, $sendEmail) { // verify the required parameter 'templateId' is set if ($templateId === null) { - throw new \InvalidArgumentException('Missing the required parameter $templateId when calling sendTemplate'); + throw new \InvalidArgumentException( + 'Missing the required parameter $templateId when calling sendTemplate' + ); } // verify the required parameter 'sendEmail' is set if ($sendEmail === null) { - throw new \InvalidArgumentException('Missing the required parameter $sendEmail when calling sendTemplate'); + throw new \InvalidArgumentException( + 'Missing the required parameter $sendEmail when calling sendTemplate' + ); } - // parse inputs - $resourcePath = "/smtp/templates/{templateId}/send"; - $httpBody = ''; + + $resourcePath = '/smtp/templates/{templateId}/send'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( - "{" . "templateId" . "}", - $this->apiClient->getSerializer()->toPathValue($templateId), + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($templateId), $resourcePath ); } + // body params $_tempBody = null; if (isset($sendEmail)) { $_tempBody = $sendEmail; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendTestTemplate + * + * Send a template to your test list + * + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendTestEmail $sendTestEmail sendTestEmail (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function sendTestTemplate($templateId, $sendTestEmail) + { + $this->sendTestTemplateWithHttpInfo($templateId, $sendTestEmail); + } + + /** + * Operation sendTestTemplateWithHttpInfo + * + * Send a template to your test list + * + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendTestEmail $sendTestEmail (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function sendTestTemplateWithHttpInfo($templateId, $sendTestEmail) + { + $returnType = ''; + $request = $this->sendTestTemplateRequest($templateId, $sendTestEmail); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\SendTemplateEmail', - '/smtp/templates/{templateId}/send' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\SendTemplateEmail', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\SendTemplateEmail', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostSendFailed', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\PostSendFailed', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation sendTestTemplate + * Operation sendTestTemplateAsync * * Send a template to your test list * - * @param int $templateId Id of the template (required) - * @param \SendinBlue\Client\Model\SendTestEmail $sendTestEmail (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendTestEmail $sendTestEmail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendTestTemplate($templateId, $sendTestEmail) + public function sendTestTemplateAsync($templateId, $sendTestEmail) { - list($response) = $this->sendTestTemplateWithHttpInfo($templateId, $sendTestEmail); - return $response; + return $this->sendTestTemplateAsyncWithHttpInfo($templateId, $sendTestEmail) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation sendTestTemplateWithHttpInfo + * Operation sendTestTemplateAsyncWithHttpInfo * * Send a template to your test list * - * @param int $templateId Id of the template (required) - * @param \SendinBlue\Client\Model\SendTestEmail $sendTestEmail (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendTestEmail $sendTestEmail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendTestTemplateWithHttpInfo($templateId, $sendTestEmail) + public function sendTestTemplateAsyncWithHttpInfo($templateId, $sendTestEmail) + { + $returnType = ''; + $request = $this->sendTestTemplateRequest($templateId, $sendTestEmail); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'sendTestTemplate' + * + * @param int $templateId Id of the template (required) + * @param \SendinBlue\Client\Model\SendTestEmail $sendTestEmail (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendTestTemplateRequest($templateId, $sendTestEmail) { // verify the required parameter 'templateId' is set if ($templateId === null) { - throw new \InvalidArgumentException('Missing the required parameter $templateId when calling sendTestTemplate'); + throw new \InvalidArgumentException( + 'Missing the required parameter $templateId when calling sendTestTemplate' + ); } // verify the required parameter 'sendTestEmail' is set if ($sendTestEmail === null) { - throw new \InvalidArgumentException('Missing the required parameter $sendTestEmail when calling sendTestTemplate'); + throw new \InvalidArgumentException( + 'Missing the required parameter $sendTestEmail when calling sendTestTemplate' + ); } - // parse inputs - $resourcePath = "/smtp/templates/{templateId}/sendTest"; - $httpBody = ''; + + $resourcePath = '/smtp/templates/{templateId}/sendTest'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( - "{" . "templateId" . "}", - $this->apiClient->getSerializer()->toPathValue($templateId), + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($templateId), $resourcePath ); } + // body params $_tempBody = null; if (isset($sendTestEmail)) { $_tempBody = $sendTestEmail; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - null, - '/smtp/templates/{templateId}/sendTest' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\PostSendFailed', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -1112,8 +2913,10 @@ public function sendTestTemplateWithHttpInfo($templateId, $sendTestEmail) * * Send a transactional email * - * @param \SendinBlue\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param \SendinBlue\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateSmtpEmail */ public function sendTransacEmail($sendSmtpEmail) @@ -1127,27 +2930,181 @@ public function sendTransacEmail($sendSmtpEmail) * * Send a transactional email * - * @param \SendinBlue\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * @param \SendinBlue\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateSmtpEmail, HTTP status code, HTTP response headers (array of strings) */ public function sendTransacEmailWithHttpInfo($sendSmtpEmail) + { + $returnType = '\SendinBlue\Client\Model\CreateSmtpEmail'; + $request = $this->sendTransacEmailRequest($sendSmtpEmail); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateSmtpEmail', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendTransacEmailAsync + * + * Send a transactional email + * + * @param \SendinBlue\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTransacEmailAsync($sendSmtpEmail) + { + return $this->sendTransacEmailAsyncWithHttpInfo($sendSmtpEmail) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendTransacEmailAsyncWithHttpInfo + * + * Send a transactional email + * + * @param \SendinBlue\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTransacEmailAsyncWithHttpInfo($sendSmtpEmail) + { + $returnType = '\SendinBlue\Client\Model\CreateSmtpEmail'; + $request = $this->sendTransacEmailRequest($sendSmtpEmail); + + 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 'sendTransacEmail' + * + * @param \SendinBlue\Client\Model\SendSmtpEmail $sendSmtpEmail Values to send a transactional email (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendTransacEmailRequest($sendSmtpEmail) { // verify the required parameter 'sendSmtpEmail' is set if ($sendSmtpEmail === null) { - throw new \InvalidArgumentException('Missing the required parameter $sendSmtpEmail when calling sendTransacEmail'); + throw new \InvalidArgumentException( + 'Missing the required parameter $sendSmtpEmail when calling sendTransacEmail' + ); } - // parse inputs - $resourcePath = "/smtp/email"; - $httpBody = ''; + + $resourcePath = '/smtp/email'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -1155,145 +3112,348 @@ public function sendTransacEmailWithHttpInfo($sendSmtpEmail) $_tempBody = $sendSmtpEmail; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateSmtpTemplate + * + * Updates an smtp templates + * + * @param int $templateId id of the template (required) + * @param \SendinBlue\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateSmtpTemplate($templateId, $smtpTemplate) + { + $this->updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate); + } + + /** + * Operation updateSmtpTemplateWithHttpInfo + * + * Updates an smtp templates + * + * @param int $templateId id of the template (required) + * @param \SendinBlue\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate) + { + $returnType = ''; + $request = $this->updateSmtpTemplateRequest($templateId, $smtpTemplate); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateSmtpEmail', - '/smtp/email' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateSmtpEmail', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateSmtpEmail', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateSmtpTemplate + * Operation updateSmtpTemplateAsync * * Updates an smtp templates * - * @param int $templateId id of the template (required) - * @param \SendinBlue\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in smtp template (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $templateId id of the template (required) + * @param \SendinBlue\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSmtpTemplate($templateId, $smtpTemplate) + public function updateSmtpTemplateAsync($templateId, $smtpTemplate) { - list($response) = $this->updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate); - return $response; + return $this->updateSmtpTemplateAsyncWithHttpInfo($templateId, $smtpTemplate) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateSmtpTemplateWithHttpInfo + * Operation updateSmtpTemplateAsyncWithHttpInfo * * Updates an smtp templates * - * @param int $templateId id of the template (required) - * @param \SendinBlue\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in smtp template (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $templateId id of the template (required) + * @param \SendinBlue\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSmtpTemplateWithHttpInfo($templateId, $smtpTemplate) + public function updateSmtpTemplateAsyncWithHttpInfo($templateId, $smtpTemplate) + { + $returnType = ''; + $request = $this->updateSmtpTemplateRequest($templateId, $smtpTemplate); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateSmtpTemplate' + * + * @param int $templateId id of the template (required) + * @param \SendinBlue\Client\Model\UpdateSmtpTemplate $smtpTemplate values to update in smtp template (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateSmtpTemplateRequest($templateId, $smtpTemplate) { // verify the required parameter 'templateId' is set if ($templateId === null) { - throw new \InvalidArgumentException('Missing the required parameter $templateId when calling updateSmtpTemplate'); + throw new \InvalidArgumentException( + 'Missing the required parameter $templateId when calling updateSmtpTemplate' + ); } // verify the required parameter 'smtpTemplate' is set if ($smtpTemplate === null) { - throw new \InvalidArgumentException('Missing the required parameter $smtpTemplate when calling updateSmtpTemplate'); + throw new \InvalidArgumentException( + 'Missing the required parameter $smtpTemplate when calling updateSmtpTemplate' + ); } - // parse inputs - $resourcePath = "/smtp/templates/{templateId}"; - $httpBody = ''; + + $resourcePath = '/smtp/templates/{templateId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($templateId !== null) { $resourcePath = str_replace( - "{" . "templateId" . "}", - $this->apiClient->getSerializer()->toPathValue($templateId), + '{' . 'templateId' . '}', + ObjectSerializer::toPathValue($templateId), $resourcePath ); } + // body params $_tempBody = null; if (isset($smtpTemplate)) { $_tempBody = $smtpTemplate; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/smtp/templates/{templateId}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/SendersApi.php b/lib/Api/SendersApi.php index f3ffab7c..cef02663 100644 --- a/lib/Api/SendersApi.php +++ b/lib/Api/SendersApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * SendersApi Class Doc Comment @@ -44,47 +50,36 @@ class SendersApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return SendersApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,8 +87,10 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Create a new sender * - * @param \SendinBlue\Client\Model\CreateSender $sender sender's name (optional) + * @param \SendinBlue\Client\Model\CreateSender $sender sender's name (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateSenderModel */ public function createSender($sender = null) @@ -107,23 +104,175 @@ public function createSender($sender = null) * * Create a new sender * - * @param \SendinBlue\Client\Model\CreateSender $sender sender's name (optional) + * @param \SendinBlue\Client\Model\CreateSender $sender sender's name (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateSenderModel, HTTP status code, HTTP response headers (array of strings) */ public function createSenderWithHttpInfo($sender = null) { - // parse inputs - $resourcePath = "/senders"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\CreateSenderModel'; + $request = $this->createSenderRequest($sender); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateSenderModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createSenderAsync + * + * Create a new sender + * + * @param \SendinBlue\Client\Model\CreateSender $sender sender's name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSenderAsync($sender = null) + { + return $this->createSenderAsyncWithHttpInfo($sender) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSenderAsyncWithHttpInfo + * + * Create a new sender + * + * @param \SendinBlue\Client\Model\CreateSender $sender sender's name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createSenderAsyncWithHttpInfo($sender = null) + { + $returnType = '\SendinBlue\Client\Model\CreateSenderModel'; + $request = $this->createSenderRequest($sender); + + 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 'createSender' + * + * @param \SendinBlue\Client\Model\CreateSender $sender sender's name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createSenderRequest($sender = null) + { + + $resourcePath = '/senders'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -131,135 +280,316 @@ public function createSenderWithHttpInfo($sender = null) $_tempBody = $sender; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteSender + * + * Delete a sender + * + * @param int $senderId Id of the sender (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteSender($senderId) + { + $this->deleteSenderWithHttpInfo($senderId); + } + + /** + * Operation deleteSenderWithHttpInfo + * + * Delete a sender + * + * @param int $senderId Id of the sender (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteSenderWithHttpInfo($senderId) + { + $returnType = ''; + $request = $this->deleteSenderRequest($senderId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateSenderModel', - '/senders' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateSenderModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateSenderModel', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteSender + * Operation deleteSenderAsync * * Delete a sender * - * @param int $senderId Id of the sender (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $senderId Id of the sender (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteSender($senderId) + public function deleteSenderAsync($senderId) { - list($response) = $this->deleteSenderWithHttpInfo($senderId); - return $response; + return $this->deleteSenderAsyncWithHttpInfo($senderId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteSenderWithHttpInfo + * Operation deleteSenderAsyncWithHttpInfo * * Delete a sender * - * @param int $senderId Id of the sender (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $senderId Id of the sender (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteSenderWithHttpInfo($senderId) + public function deleteSenderAsyncWithHttpInfo($senderId) + { + $returnType = ''; + $request = $this->deleteSenderRequest($senderId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteSender' + * + * @param int $senderId Id of the sender (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteSenderRequest($senderId) { // verify the required parameter 'senderId' is set if ($senderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $senderId when calling deleteSender'); + throw new \InvalidArgumentException( + 'Missing the required parameter $senderId when calling deleteSender' + ); } - // parse inputs - $resourcePath = "/senders/{senderId}"; - $httpBody = ''; + + $resourcePath = '/senders/{senderId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($senderId !== null) { $resourcePath = str_replace( - "{" . "senderId" . "}", - $this->apiClient->getSerializer()->toPathValue($senderId), + '{' . 'senderId' . '}', + ObjectSerializer::toPathValue($senderId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/senders/{senderId}' - ); - - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); } /** @@ -267,7 +597,9 @@ public function deleteSenderWithHttpInfo($senderId) * * Return all the dedicated IPs for your account * + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetIps */ public function getIps() @@ -281,163 +613,526 @@ public function getIps() * * Return all the dedicated IPs for your account * + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetIps, HTTP status code, HTTP response headers (array of strings) */ public function getIpsWithHttpInfo() { - // parse inputs - $resourcePath = "/senders/ips"; - $httpBody = ''; - $queryParams = []; - $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); - + $returnType = '\SendinBlue\Client\Model\GetIps'; + $request = $this->getIpsRequest(); - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; - } - // make the API Call try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetIps', - '/senders/ips' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetIps', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetIps', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetIps', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getIpsFromSender + * Operation getIpsAsync * - * Return all the dedicated IPs for a sender + * Return all the dedicated IPs for your account * - * @param int $senderId Id of the sender (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetIpsFromSender + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getIpsFromSender($senderId) + public function getIpsAsync() { - list($response) = $this->getIpsFromSenderWithHttpInfo($senderId); - return $response; + return $this->getIpsAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getIpsFromSenderWithHttpInfo + * Operation getIpsAsyncWithHttpInfo * - * Return all the dedicated IPs for a sender + * Return all the dedicated IPs for your account * - * @param int $senderId Id of the sender (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetIpsFromSender, HTTP status code, HTTP response headers (array of strings) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getIpsFromSenderWithHttpInfo($senderId) + public function getIpsAsyncWithHttpInfo() { - // verify the required parameter 'senderId' is set - if ($senderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $senderId when calling getIpsFromSender'); - } - // parse inputs - $resourcePath = "/senders/{senderId}/ips"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\GetIps'; + $request = $this->getIpsRequest(); + + 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 'getIps' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getIpsRequest() + { + + $resourcePath = '/senders/ips'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; - // path params - if ($senderId !== null) { - $resourcePath = str_replace( - "{" . "senderId" . "}", - $this->apiClient->getSerializer()->toPathValue($senderId), - $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetIpsFromSender', - '/senders/{senderId}/ips' - ); - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetIpsFromSender', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { + $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 getIpsFromSender + * + * Return all the dedicated IPs for a sender + * + * @param int $senderId Id of the sender (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetIpsFromSender + */ + public function getIpsFromSender($senderId) + { + list($response) = $this->getIpsFromSenderWithHttpInfo($senderId); + return $response; + } + + /** + * Operation getIpsFromSenderWithHttpInfo + * + * Return all the dedicated IPs for a sender + * + * @param int $senderId Id of the sender (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetIpsFromSender, HTTP status code, HTTP response headers (array of strings) + */ + public function getIpsFromSenderWithHttpInfo($senderId) + { + $returnType = '\SendinBlue\Client\Model\GetIpsFromSender'; + $request = $this->getIpsFromSenderRequest($senderId); + + 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 = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetIpsFromSender', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetIpsFromSender', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } + /** + * Operation getIpsFromSenderAsync + * + * Return all the dedicated IPs for a sender + * + * @param int $senderId Id of the sender (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIpsFromSenderAsync($senderId) + { + return $this->getIpsFromSenderAsyncWithHttpInfo($senderId) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getIpsFromSenderAsyncWithHttpInfo + * + * Return all the dedicated IPs for a sender + * + * @param int $senderId Id of the sender (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIpsFromSenderAsyncWithHttpInfo($senderId) + { + $returnType = '\SendinBlue\Client\Model\GetIpsFromSender'; + $request = $this->getIpsFromSenderRequest($senderId); + + 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 'getIpsFromSender' + * + * @param int $senderId Id of the sender (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getIpsFromSenderRequest($senderId) + { + // verify the required parameter 'senderId' is set + if ($senderId === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $senderId when calling getIpsFromSender' + ); + } + + $resourcePath = '/senders/{senderId}/ips'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // path params + if ($senderId !== null) { + $resourcePath = str_replace( + '{' . 'senderId' . '}', + ObjectSerializer::toPathValue($senderId), + $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; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($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; + } + + $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 getSenders * * Get the list of all your senders * - * @param string $ip Filter your senders for a specific ip (available for dedicated IP usage only) (optional) - * @param string $domain Filter your senders for a specific domain (optional) + * @param string $ip Filter your senders for a specific ip (available for dedicated IP usage only) (optional) + * @param string $domain Filter your senders for a specific domain (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetSendersList */ public function getSenders($ip = null, $domain = null) @@ -451,169 +1146,527 @@ public function getSenders($ip = null, $domain = null) * * Get the list of all your senders * - * @param string $ip Filter your senders for a specific ip (available for dedicated IP usage only) (optional) - * @param string $domain Filter your senders for a specific domain (optional) + * @param string $ip Filter your senders for a specific ip (available for dedicated IP usage only) (optional) + * @param string $domain Filter your senders for a specific domain (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetSendersList, HTTP status code, HTTP response headers (array of strings) */ public function getSendersWithHttpInfo($ip = null, $domain = null) { - // parse inputs - $resourcePath = "/senders"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\GetSendersList'; + $request = $this->getSendersRequest($ip, $domain); + + 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\GetSendersList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSendersAsync + * + * Get the list of all your senders + * + * @param string $ip Filter your senders for a specific ip (available for dedicated IP usage only) (optional) + * @param string $domain Filter your senders for a specific domain (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSendersAsync($ip = null, $domain = null) + { + return $this->getSendersAsyncWithHttpInfo($ip, $domain) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSendersAsyncWithHttpInfo + * + * Get the list of all your senders + * + * @param string $ip Filter your senders for a specific ip (available for dedicated IP usage only) (optional) + * @param string $domain Filter your senders for a specific domain (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSendersAsyncWithHttpInfo($ip = null, $domain = null) + { + $returnType = '\SendinBlue\Client\Model\GetSendersList'; + $request = $this->getSendersRequest($ip, $domain); + + 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 'getSenders' + * + * @param string $ip Filter your senders for a specific ip (available for dedicated IP usage only) (optional) + * @param string $domain Filter your senders for a specific domain (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSendersRequest($ip = null, $domain = null) + { + + $resourcePath = '/senders'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($ip !== null) { - $queryParams['ip'] = $this->apiClient->getSerializer()->toQueryValue($ip); + $queryParams['ip'] = ObjectSerializer::toQueryValue($ip); } // query params if ($domain !== null) { - $queryParams['domain'] = $this->apiClient->getSerializer()->toQueryValue($domain); + $queryParams['domain'] = ObjectSerializer::toQueryValue($domain); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 updateSender + * + * Update a sender + * + * @param int $senderId Id of the sender (required) + * @param \SendinBlue\Client\Model\UpdateSender $sender sender's name (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateSender($senderId, $sender = null) + { + $this->updateSenderWithHttpInfo($senderId, $sender); + } + + /** + * Operation updateSenderWithHttpInfo + * + * Update a sender + * + * @param int $senderId Id of the sender (required) + * @param \SendinBlue\Client\Model\UpdateSender $sender sender's name (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateSenderWithHttpInfo($senderId, $sender = null) + { + $returnType = ''; + $request = $this->updateSenderRequest($senderId, $sender); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetSendersList', - '/senders' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetSendersList', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetSendersList', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateSender + * Operation updateSenderAsync * * Update a sender * - * @param int $senderId Id of the sender (required) - * @param \SendinBlue\Client\Model\UpdateSender $sender sender's name (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $senderId Id of the sender (required) + * @param \SendinBlue\Client\Model\UpdateSender $sender sender's name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSender($senderId, $sender = null) + public function updateSenderAsync($senderId, $sender = null) { - list($response) = $this->updateSenderWithHttpInfo($senderId, $sender); - return $response; + return $this->updateSenderAsyncWithHttpInfo($senderId, $sender) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateSenderWithHttpInfo + * Operation updateSenderAsyncWithHttpInfo * * Update a sender * - * @param int $senderId Id of the sender (required) - * @param \SendinBlue\Client\Model\UpdateSender $sender sender's name (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $senderId Id of the sender (required) + * @param \SendinBlue\Client\Model\UpdateSender $sender sender's name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSenderWithHttpInfo($senderId, $sender = null) + public function updateSenderAsyncWithHttpInfo($senderId, $sender = null) + { + $returnType = ''; + $request = $this->updateSenderRequest($senderId, $sender); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateSender' + * + * @param int $senderId Id of the sender (required) + * @param \SendinBlue\Client\Model\UpdateSender $sender sender's name (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateSenderRequest($senderId, $sender = null) { // verify the required parameter 'senderId' is set if ($senderId === null) { - throw new \InvalidArgumentException('Missing the required parameter $senderId when calling updateSender'); + throw new \InvalidArgumentException( + 'Missing the required parameter $senderId when calling updateSender' + ); } - // parse inputs - $resourcePath = "/senders/{senderId}"; - $httpBody = ''; + + $resourcePath = '/senders/{senderId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($senderId !== null) { $resourcePath = str_replace( - "{" . "senderId" . "}", - $this->apiClient->getSerializer()->toPathValue($senderId), + '{' . 'senderId' . '}', + ObjectSerializer::toPathValue($senderId), $resourcePath ); } + // body params $_tempBody = null; if (isset($sender)) { $_tempBody = $sender; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/senders/{senderId}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/TransactionalSMSApi.php b/lib/Api/TransactionalSMSApi.php index cae80a28..472b4a2e 100644 --- a/lib/Api/TransactionalSMSApi.php +++ b/lib/Api/TransactionalSMSApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * TransactionalSMSApi Class Doc Comment @@ -44,47 +50,36 @@ class TransactionalSMSApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return TransactionalSMSApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,15 +87,17 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Get all the SMS activity (unaggregated events) * - * @param int $limit Number of documents per page (optional, default to 50) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $phoneNumber Filter the report for a specific phone number (optional) - * @param string $event Filter the report for specific events (optional) - * @param string $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $phoneNumber Filter the report for a specific phone number (optional) + * @param string $event Filter the report for specific events (optional) + * @param string $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\GetSmsEventReport */ public function getSmsEvents($limit = '50', $startDate = null, $endDate = null, $offset = '0', $days = null, $phoneNumber = null, $event = null, $tags = null) @@ -114,308 +111,891 @@ public function getSmsEvents($limit = '50', $startDate = null, $endDate = null, * * Get all the SMS activity (unaggregated events) * - * @param int $limit Number of documents per page (optional, default to 50) - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) - * @param int $offset Index of the first document of the page (optional, default to 0) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $phoneNumber Filter the report for a specific phone number (optional) - * @param string $event Filter the report for specific events (optional) - * @param string $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * @param int $limit Number of documents per page (optional, default to 50) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $phoneNumber Filter the report for a specific phone number (optional) + * @param string $event Filter the report for specific events (optional) + * @param string $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\GetSmsEventReport, HTTP status code, HTTP response headers (array of strings) */ public function getSmsEventsWithHttpInfo($limit = '50', $startDate = null, $endDate = null, $offset = '0', $days = null, $phoneNumber = null, $event = null, $tags = null) { - if (!is_null($limit) && ($limit > 100)) { + $returnType = '\SendinBlue\Client\Model\GetSmsEventReport'; + $request = $this->getSmsEventsRequest($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags); + + 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\GetSmsEventReport', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getSmsEventsAsync + * + * Get all the SMS activity (unaggregated events) + * + * @param int $limit Number of documents per page (optional, default to 50) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $phoneNumber Filter the report for a specific phone number (optional) + * @param string $event Filter the report for specific events (optional) + * @param string $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmsEventsAsync($limit = '50', $startDate = null, $endDate = null, $offset = '0', $days = null, $phoneNumber = null, $event = null, $tags = null) + { + return $this->getSmsEventsAsyncWithHttpInfo($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getSmsEventsAsyncWithHttpInfo + * + * Get all the SMS activity (unaggregated events) + * + * @param int $limit Number of documents per page (optional, default to 50) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $phoneNumber Filter the report for a specific phone number (optional) + * @param string $event Filter the report for specific events (optional) + * @param string $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getSmsEventsAsyncWithHttpInfo($limit = '50', $startDate = null, $endDate = null, $offset = '0', $days = null, $phoneNumber = null, $event = null, $tags = null) + { + $returnType = '\SendinBlue\Client\Model\GetSmsEventReport'; + $request = $this->getSmsEventsRequest($limit, $startDate, $endDate, $offset, $days, $phoneNumber, $event, $tags); + + 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 'getSmsEvents' + * + * @param int $limit Number of documents per page (optional, default to 50) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $offset Index of the first document of the page (optional, default to 0) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $phoneNumber Filter the report for a specific phone number (optional) + * @param string $event Filter the report for specific events (optional) + * @param string $tags Filter the report for specific tags passed as a serialized urlencoded array (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getSmsEventsRequest($limit = '50', $startDate = null, $endDate = null, $offset = '0', $days = null, $phoneNumber = null, $event = null, $tags = null) + { + if ($limit !== null && $limit > 100) { throw new \InvalidArgumentException('invalid value for "$limit" when calling TransactionalSMSApi.getSmsEvents, must be smaller than or equal to 100.'); } - // parse inputs - $resourcePath = "/transactionalSMS/statistics/events"; - $httpBody = ''; + + $resourcePath = '/transactionalSMS/statistics/events'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($limit !== null) { - $queryParams['limit'] = $this->apiClient->getSerializer()->toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); } // query params if ($startDate !== null) { - $queryParams['startDate'] = $this->apiClient->getSerializer()->toQueryValue($startDate); + $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); } // query params if ($endDate !== null) { - $queryParams['endDate'] = $this->apiClient->getSerializer()->toQueryValue($endDate); + $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); } // query params if ($offset !== null) { - $queryParams['offset'] = $this->apiClient->getSerializer()->toQueryValue($offset); + $queryParams['offset'] = ObjectSerializer::toQueryValue($offset); } // query params if ($days !== null) { - $queryParams['days'] = $this->apiClient->getSerializer()->toQueryValue($days); + $queryParams['days'] = ObjectSerializer::toQueryValue($days); } // query params if ($phoneNumber !== null) { - $queryParams['phoneNumber'] = $this->apiClient->getSerializer()->toQueryValue($phoneNumber); + $queryParams['phoneNumber'] = ObjectSerializer::toQueryValue($phoneNumber); } // query params if ($event !== null) { - $queryParams['event'] = $this->apiClient->getSerializer()->toQueryValue($event); + $queryParams['event'] = ObjectSerializer::toQueryValue($event); } // query params if ($tags !== null) { - $queryParams['tags'] = $this->apiClient->getSerializer()->toQueryValue($tags); + $queryParams['tags'] = ObjectSerializer::toQueryValue($tags); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getTransacAggregatedSmsReport + * + * Get your SMS activity aggregated over a period of time + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with startDate and endDate (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetTransacAggregatedSmsReport + */ + public function getTransacAggregatedSmsReport($startDate = null, $endDate = null, $days = null, $tag = null) + { + list($response) = $this->getTransacAggregatedSmsReportWithHttpInfo($startDate, $endDate, $days, $tag); + return $response; + } + + /** + * Operation getTransacAggregatedSmsReportWithHttpInfo + * + * Get your SMS activity aggregated over a period of time + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with startDate and endDate (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetTransacAggregatedSmsReport, HTTP status code, HTTP response headers (array of strings) + */ + public function getTransacAggregatedSmsReportWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + { + $returnType = '\SendinBlue\Client\Model\GetTransacAggregatedSmsReport'; + $request = $this->getTransacAggregatedSmsReportRequest($startDate, $endDate, $days, $tag); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetSmsEventReport', - '/transactionalSMS/statistics/events' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetSmsEventReport', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetSmsEventReport', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetTransacAggregatedSmsReport', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getTransacAggregatedSmsReport + * Operation getTransacAggregatedSmsReportAsync * * Get your SMS activity aggregated over a period of time * - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with startDate and endDate (optional) - * @param string $tag Filter on a tag (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetTransacAggregatedSmsReport + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with startDate and endDate (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTransacAggregatedSmsReport($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacAggregatedSmsReportAsync($startDate = null, $endDate = null, $days = null, $tag = null) { - list($response) = $this->getTransacAggregatedSmsReportWithHttpInfo($startDate, $endDate, $days, $tag); - return $response; + return $this->getTransacAggregatedSmsReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getTransacAggregatedSmsReportWithHttpInfo + * Operation getTransacAggregatedSmsReportAsyncWithHttpInfo * * Get your SMS activity aggregated over a period of time * - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with startDate and endDate (optional) - * @param string $tag Filter on a tag (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetTransacAggregatedSmsReport, HTTP status code, HTTP response headers (array of strings) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with startDate and endDate (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTransacAggregatedSmsReportWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacAggregatedSmsReportAsyncWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) { - // parse inputs - $resourcePath = "/transactionalSMS/statistics/aggregatedReport"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\GetTransacAggregatedSmsReport'; + $request = $this->getTransacAggregatedSmsReportRequest($startDate, $endDate, $days, $tag); + + 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 'getTransacAggregatedSmsReport' + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with startDate and endDate (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getTransacAggregatedSmsReportRequest($startDate = null, $endDate = null, $days = null, $tag = null) + { + + $resourcePath = '/transactionalSMS/statistics/aggregatedReport'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($startDate !== null) { - $queryParams['startDate'] = $this->apiClient->getSerializer()->toQueryValue($startDate); + $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); } // query params if ($endDate !== null) { - $queryParams['endDate'] = $this->apiClient->getSerializer()->toQueryValue($endDate); + $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); } // query params if ($days !== null) { - $queryParams['days'] = $this->apiClient->getSerializer()->toQueryValue($days); + $queryParams['days'] = ObjectSerializer::toQueryValue($days); } // query params if ($tag !== null) { - $queryParams['tag'] = $this->apiClient->getSerializer()->toQueryValue($tag); + $queryParams['tag'] = ObjectSerializer::toQueryValue($tag); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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 getTransacSmsReport + * + * Get your SMS activity aggregated per day + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetTransacSmsReport + */ + public function getTransacSmsReport($startDate = null, $endDate = null, $days = null, $tag = null) + { + list($response) = $this->getTransacSmsReportWithHttpInfo($startDate, $endDate, $days, $tag); + return $response; + } + + /** + * Operation getTransacSmsReportWithHttpInfo + * + * Get your SMS activity aggregated per day + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetTransacSmsReport, HTTP status code, HTTP response headers (array of strings) + */ + public function getTransacSmsReportWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + { + $returnType = '\SendinBlue\Client\Model\GetTransacSmsReport'; + $request = $this->getTransacSmsReportRequest($startDate, $endDate, $days, $tag); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetTransacAggregatedSmsReport', - '/transactionalSMS/statistics/aggregatedReport' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetTransacAggregatedSmsReport', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetTransacAggregatedSmsReport', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetTransacSmsReport', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getTransacSmsReport + * Operation getTransacSmsReportAsync * * Get your SMS activity aggregated per day * - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $tag Filter on a tag (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetTransacSmsReport + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTransacSmsReport($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacSmsReportAsync($startDate = null, $endDate = null, $days = null, $tag = null) { - list($response) = $this->getTransacSmsReportWithHttpInfo($startDate, $endDate, $days, $tag); - return $response; + return $this->getTransacSmsReportAsyncWithHttpInfo($startDate, $endDate, $days, $tag) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getTransacSmsReportWithHttpInfo + * Operation getTransacSmsReportAsyncWithHttpInfo * * Get your SMS activity aggregated per day * - * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) - * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) - * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) - * @param string $tag Filter on a tag (optional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetTransacSmsReport, HTTP status code, HTTP response headers (array of strings) + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTransacSmsReportWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) + public function getTransacSmsReportAsyncWithHttpInfo($startDate = null, $endDate = null, $days = null, $tag = null) { - // parse inputs - $resourcePath = "/transactionalSMS/statistics/reports"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\GetTransacSmsReport'; + $request = $this->getTransacSmsReportRequest($startDate, $endDate, $days, $tag); + + 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 'getTransacSmsReport' + * + * @param \DateTime $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report (optional) + * @param \DateTime $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report (optional) + * @param int $days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' (optional) + * @param string $tag Filter on a tag (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getTransacSmsReportRequest($startDate = null, $endDate = null, $days = null, $tag = null) + { + + $resourcePath = '/transactionalSMS/statistics/reports'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($startDate !== null) { - $queryParams['startDate'] = $this->apiClient->getSerializer()->toQueryValue($startDate); + $queryParams['startDate'] = ObjectSerializer::toQueryValue($startDate); } // query params if ($endDate !== null) { - $queryParams['endDate'] = $this->apiClient->getSerializer()->toQueryValue($endDate); + $queryParams['endDate'] = ObjectSerializer::toQueryValue($endDate); } // query params if ($days !== null) { - $queryParams['days'] = $this->apiClient->getSerializer()->toQueryValue($days); + $queryParams['days'] = ObjectSerializer::toQueryValue($days); } // query params if ($tag !== null) { - $queryParams['tag'] = $this->apiClient->getSerializer()->toQueryValue($tag); + $queryParams['tag'] = ObjectSerializer::toQueryValue($tag); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetTransacSmsReport', - '/transactionalSMS/statistics/reports' - ); - - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetTransacSmsReport', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetTransacSmsReport', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - throw $e; + $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 + ); } /** @@ -423,8 +1003,10 @@ public function getTransacSmsReportWithHttpInfo($startDate = null, $endDate = nu * * Send the SMS campaign to the specified mobile number * - * @param \SendinBlue\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param \SendinBlue\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\SendSms */ public function sendTransacSms($sendTransacSms) @@ -438,27 +1020,189 @@ public function sendTransacSms($sendTransacSms) * * Send the SMS campaign to the specified mobile number * - * @param \SendinBlue\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * @param \SendinBlue\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\SendSms, HTTP status code, HTTP response headers (array of strings) */ public function sendTransacSmsWithHttpInfo($sendTransacSms) + { + $returnType = '\SendinBlue\Client\Model\SendSms'; + $request = $this->sendTransacSmsRequest($sendTransacSms); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\SendSms', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendTransacSmsAsync + * + * Send the SMS campaign to the specified mobile number + * + * @param \SendinBlue\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTransacSmsAsync($sendTransacSms) + { + return $this->sendTransacSmsAsyncWithHttpInfo($sendTransacSms) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendTransacSmsAsyncWithHttpInfo + * + * Send the SMS campaign to the specified mobile number + * + * @param \SendinBlue\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendTransacSmsAsyncWithHttpInfo($sendTransacSms) + { + $returnType = '\SendinBlue\Client\Model\SendSms'; + $request = $this->sendTransacSmsRequest($sendTransacSms); + + 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 'sendTransacSms' + * + * @param \SendinBlue\Client\Model\SendTransacSms $sendTransacSms Values to send a transactional SMS (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function sendTransacSmsRequest($sendTransacSms) { // verify the required parameter 'sendTransacSms' is set if ($sendTransacSms === null) { - throw new \InvalidArgumentException('Missing the required parameter $sendTransacSms when calling sendTransacSms'); + throw new \InvalidArgumentException( + 'Missing the required parameter $sendTransacSms when calling sendTransacSms' + ); } - // parse inputs - $resourcePath = "/transactionalSMS/sms"; - $httpBody = ''; + + $resourcePath = '/transactionalSMS/sms'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -466,47 +1210,88 @@ public function sendTransacSmsWithHttpInfo($sendTransacSms) $_tempBody = $sendTransacSms; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\SendSms', - '/transactionalSMS/sms' - ); - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\SendSms', $httpHeader), $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\SendSms', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 402: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/Api/WebhooksApi.php b/lib/Api/WebhooksApi.php index a1ed3bd3..f873d656 100644 --- a/lib/Api/WebhooksApi.php +++ b/lib/Api/WebhooksApi.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -28,10 +28,16 @@ namespace SendinBlue\Client\Api; -use \SendinBlue\Client\ApiClient; -use \SendinBlue\Client\ApiException; -use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ObjectSerializer; +use GuzzleHttp\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\RequestOptions; +use SendinBlue\Client\ApiException; +use SendinBlue\Client\Configuration; +use SendinBlue\Client\HeaderSelector; +use SendinBlue\Client\ObjectSerializer; /** * WebhooksApi Class Doc Comment @@ -44,47 +50,36 @@ class WebhooksApi { /** - * API Client - * - * @var \SendinBlue\Client\ApiClient instance of the ApiClient + * @var ClientInterface */ - protected $apiClient; + protected $client; /** - * Constructor - * - * @param \SendinBlue\Client\ApiClient|null $apiClient The api client to use + * @var Configuration */ - public function __construct(\SendinBlue\Client\ApiClient $apiClient = null) - { - if ($apiClient === null) { - $apiClient = new ApiClient(); - } - - $this->apiClient = $apiClient; - } + protected $config; /** - * Get API client - * - * @return \SendinBlue\Client\ApiClient get the API client + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector */ - public function getApiClient() - { - return $this->apiClient; + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); } /** - * Set the API client - * - * @param \SendinBlue\Client\ApiClient $apiClient set the API client - * - * @return WebhooksApi + * @return Configuration */ - public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) + public function getConfig() { - $this->apiClient = $apiClient; - return $this; + return $this->config; } /** @@ -92,8 +87,10 @@ public function setApiClient(\SendinBlue\Client\ApiClient $apiClient) * * Create a webhook * - * @param \SendinBlue\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * @param \SendinBlue\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return \SendinBlue\Client\Model\CreateModel */ public function createWebhook($createWebhook) @@ -107,27 +104,181 @@ public function createWebhook($createWebhook) * * Create a webhook * - * @param \SendinBlue\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * @param \SendinBlue\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException * @return array of \SendinBlue\Client\Model\CreateModel, HTTP status code, HTTP response headers (array of strings) */ public function createWebhookWithHttpInfo($createWebhook) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createWebhookRequest($createWebhook); + + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\CreateModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createWebhookAsync + * + * Create a webhook + * + * @param \SendinBlue\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createWebhookAsync($createWebhook) + { + return $this->createWebhookAsyncWithHttpInfo($createWebhook) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createWebhookAsyncWithHttpInfo + * + * Create a webhook + * + * @param \SendinBlue\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createWebhookAsyncWithHttpInfo($createWebhook) + { + $returnType = '\SendinBlue\Client\Model\CreateModel'; + $request = $this->createWebhookRequest($createWebhook); + + 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 'createWebhook' + * + * @param \SendinBlue\Client\Model\CreateWebhook $createWebhook Values to create a webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function createWebhookRequest($createWebhook) { // verify the required parameter 'createWebhook' is set if ($createWebhook === null) { - throw new \InvalidArgumentException('Missing the required parameter $createWebhook when calling createWebhook'); + throw new \InvalidArgumentException( + 'Missing the required parameter $createWebhook when calling createWebhook' + ); } - // parse inputs - $resourcePath = "/webhooks"; - $httpBody = ''; + + $resourcePath = '/webhooks'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + + // body params $_tempBody = null; @@ -135,414 +286,1142 @@ public function createWebhookWithHttpInfo($createWebhook) $_tempBody = $createWebhook; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteWebhook + * + * Delete a webhook + * + * @param int $webhookId Id of the webhook (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function deleteWebhook($webhookId) + { + $this->deleteWebhookWithHttpInfo($webhookId); + } + + /** + * Operation deleteWebhookWithHttpInfo + * + * Delete a webhook + * + * @param int $webhookId Id of the webhook (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteWebhookWithHttpInfo($webhookId) + { + $returnType = ''; + $request = $this->deleteWebhookRequest($webhookId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'POST', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\CreateModel', - '/webhooks' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\CreateModel', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\CreateModel', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation deleteWebhook + * Operation deleteWebhookAsync * * Delete a webhook * - * @param int $webhookId Id of the webhook (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $webhookId Id of the webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteWebhook($webhookId) + public function deleteWebhookAsync($webhookId) { - list($response) = $this->deleteWebhookWithHttpInfo($webhookId); - return $response; + return $this->deleteWebhookAsyncWithHttpInfo($webhookId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation deleteWebhookWithHttpInfo + * Operation deleteWebhookAsyncWithHttpInfo * * Delete a webhook * - * @param int $webhookId Id of the webhook (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $webhookId Id of the webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteWebhookWithHttpInfo($webhookId) + public function deleteWebhookAsyncWithHttpInfo($webhookId) + { + $returnType = ''; + $request = $this->deleteWebhookRequest($webhookId); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'deleteWebhook' + * + * @param int $webhookId Id of the webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function deleteWebhookRequest($webhookId) { // verify the required parameter 'webhookId' is set if ($webhookId === null) { - throw new \InvalidArgumentException('Missing the required parameter $webhookId when calling deleteWebhook'); + throw new \InvalidArgumentException( + 'Missing the required parameter $webhookId when calling deleteWebhook' + ); } - // parse inputs - $resourcePath = "/webhooks/{webhookId}"; - $httpBody = ''; + + $resourcePath = '/webhooks/{webhookId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($webhookId !== null) { $resourcePath = str_replace( - "{" . "webhookId" . "}", - $this->apiClient->getSerializer()->toPathValue($webhookId), + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhookId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call + + $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getWebhook + * + * Get a webhook details + * + * @param int $webhookId Id of the webhook (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetWebhook + */ + public function getWebhook($webhookId) + { + list($response) = $this->getWebhookWithHttpInfo($webhookId); + return $response; + } + + /** + * Operation getWebhookWithHttpInfo + * + * Get a webhook details + * + * @param int $webhookId Id of the webhook (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetWebhook, HTTP status code, HTTP response headers (array of strings) + */ + public function getWebhookWithHttpInfo($webhookId) + { + $returnType = '\SendinBlue\Client\Model\GetWebhook'; + $request = $this->getWebhookRequest($webhookId); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'DELETE', - $queryParams, - $httpBody, - $headerParams, - null, - '/webhooks/{webhookId}' - ); + $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() + ]; - return [null, $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetWebhook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getWebhook + * Operation getWebhookAsync * * Get a webhook details * - * @param int $webhookId Id of the webhook (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetWebhook + * @param int $webhookId Id of the webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getWebhook($webhookId) + public function getWebhookAsync($webhookId) { - list($response) = $this->getWebhookWithHttpInfo($webhookId); - return $response; + return $this->getWebhookAsyncWithHttpInfo($webhookId) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getWebhookWithHttpInfo + * Operation getWebhookAsyncWithHttpInfo * * Get a webhook details * - * @param int $webhookId Id of the webhook (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetWebhook, HTTP status code, HTTP response headers (array of strings) + * @param int $webhookId Id of the webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getWebhookWithHttpInfo($webhookId) + public function getWebhookAsyncWithHttpInfo($webhookId) + { + $returnType = '\SendinBlue\Client\Model\GetWebhook'; + $request = $this->getWebhookRequest($webhookId); + + 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 'getWebhook' + * + * @param int $webhookId Id of the webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getWebhookRequest($webhookId) { // verify the required parameter 'webhookId' is set if ($webhookId === null) { - throw new \InvalidArgumentException('Missing the required parameter $webhookId when calling getWebhook'); + throw new \InvalidArgumentException( + 'Missing the required parameter $webhookId when calling getWebhook' + ); } - // parse inputs - $resourcePath = "/webhooks/{webhookId}"; - $httpBody = ''; + + $resourcePath = '/webhooks/{webhookId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($webhookId !== null) { $resourcePath = str_replace( - "{" . "webhookId" . "}", - $this->apiClient->getSerializer()->toPathValue($webhookId), + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhookId), $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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 getWebhooks + * + * Get all webhooks + * + * @param string $type Filter on webhook type (optional, default to transactional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \SendinBlue\Client\Model\GetWebhooks + */ + public function getWebhooks($type = 'transactional') + { + list($response) = $this->getWebhooksWithHttpInfo($type); + return $response; + } + + /** + * Operation getWebhooksWithHttpInfo + * + * Get all webhooks + * + * @param string $type Filter on webhook type (optional, default to transactional) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \SendinBlue\Client\Model\GetWebhooks, HTTP status code, HTTP response headers (array of strings) + */ + public function getWebhooksWithHttpInfo($type = 'transactional') + { + $returnType = '\SendinBlue\Client\Model\GetWebhooks'; + $request = $this->getWebhooksRequest($type); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetWebhook', - '/webhooks/{webhookId}' - ); + $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() + ]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetWebhook', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetWebhook', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\GetWebhooks', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation getWebhooks + * Operation getWebhooksAsync * * Get all webhooks * - * @param string $type Filter on webhook type (optional, default to transactional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return \SendinBlue\Client\Model\GetWebhooks + * @param string $type Filter on webhook type (optional, default to transactional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getWebhooks($type = 'transactional') + public function getWebhooksAsync($type = 'transactional') { - list($response) = $this->getWebhooksWithHttpInfo($type); - return $response; + return $this->getWebhooksAsyncWithHttpInfo($type) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation getWebhooksWithHttpInfo + * Operation getWebhooksAsyncWithHttpInfo * * Get all webhooks * - * @param string $type Filter on webhook type (optional, default to transactional) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of \SendinBlue\Client\Model\GetWebhooks, HTTP status code, HTTP response headers (array of strings) + * @param string $type Filter on webhook type (optional, default to transactional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getWebhooksWithHttpInfo($type = 'transactional') + public function getWebhooksAsyncWithHttpInfo($type = 'transactional') { - // parse inputs - $resourcePath = "/webhooks"; - $httpBody = ''; + $returnType = '\SendinBlue\Client\Model\GetWebhooks'; + $request = $this->getWebhooksRequest($type); + + 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 'getWebhooks' + * + * @param string $type Filter on webhook type (optional, default to transactional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function getWebhooksRequest($type = 'transactional') + { + + $resourcePath = '/webhooks'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; // query params if ($type !== null) { - $queryParams['type'] = $this->apiClient->getSerializer()->toQueryValue($type); + $queryParams['type'] = ObjectSerializer::toQueryValue($type); + } + + + // 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)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } - // make the API Call + + $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 updateWebhook + * + * Update a webhook + * + * @param int $webhookId Id of the webhook (required) + * @param \SendinBlue\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function updateWebhook($webhookId, $updateWebhook) + { + $this->updateWebhookWithHttpInfo($webhookId, $updateWebhook); + } + + /** + * Operation updateWebhookWithHttpInfo + * + * Update a webhook + * + * @param int $webhookId Id of the webhook (required) + * @param \SendinBlue\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * + * @throws \SendinBlue\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWebhookWithHttpInfo($webhookId, $updateWebhook) + { + $returnType = ''; + $request = $this->updateWebhookRequest($webhookId, $updateWebhook); + try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'GET', - $queryParams, - $httpBody, - $headerParams, - '\SendinBlue\Client\Model\GetWebhooks', - '/webhooks' - ); + $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() + ); + } + + return [null, $statusCode, $response->getHeaders()]; - return [$this->apiClient->getSerializer()->deserialize($response, '\SendinBlue\Client\Model\GetWebhooks', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\GetWebhooks', $e->getResponseHeaders()); + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SendinBlue\Client\Model\ErrorModel', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } - throw $e; } } /** - * Operation updateWebhook + * Operation updateWebhookAsync * * Update a webhook * - * @param int $webhookId Id of the webhook (required) - * @param \SendinBlue\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return void + * @param int $webhookId Id of the webhook (required) + * @param \SendinBlue\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateWebhook($webhookId, $updateWebhook) + public function updateWebhookAsync($webhookId, $updateWebhook) { - list($response) = $this->updateWebhookWithHttpInfo($webhookId, $updateWebhook); - return $response; + return $this->updateWebhookAsyncWithHttpInfo($webhookId, $updateWebhook) + ->then( + function ($response) { + return $response[0]; + } + ); } /** - * Operation updateWebhookWithHttpInfo + * Operation updateWebhookAsyncWithHttpInfo * * Update a webhook * - * @param int $webhookId Id of the webhook (required) - * @param \SendinBlue\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) - * @throws \SendinBlue\Client\ApiException on non-2xx response - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @param int $webhookId Id of the webhook (required) + * @param \SendinBlue\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateWebhookWithHttpInfo($webhookId, $updateWebhook) + public function updateWebhookAsyncWithHttpInfo($webhookId, $updateWebhook) + { + $returnType = ''; + $request = $this->updateWebhookRequest($webhookId, $updateWebhook); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $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 'updateWebhook' + * + * @param int $webhookId Id of the webhook (required) + * @param \SendinBlue\Client\Model\UpdateWebhook $updateWebhook Values to update a webhook (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function updateWebhookRequest($webhookId, $updateWebhook) { // verify the required parameter 'webhookId' is set if ($webhookId === null) { - throw new \InvalidArgumentException('Missing the required parameter $webhookId when calling updateWebhook'); + throw new \InvalidArgumentException( + 'Missing the required parameter $webhookId when calling updateWebhook' + ); } // verify the required parameter 'updateWebhook' is set if ($updateWebhook === null) { - throw new \InvalidArgumentException('Missing the required parameter $updateWebhook when calling updateWebhook'); + throw new \InvalidArgumentException( + 'Missing the required parameter $updateWebhook when calling updateWebhook' + ); } - // parse inputs - $resourcePath = "/webhooks/{webhookId}"; - $httpBody = ''; + + $resourcePath = '/webhooks/{webhookId}'; + $formParams = []; $queryParams = []; $headerParams = []; - $formParams = []; - $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + $httpBody = ''; + $multipart = false; + // path params if ($webhookId !== null) { $resourcePath = str_replace( - "{" . "webhookId" . "}", - $this->apiClient->getSerializer()->toPathValue($webhookId), + '{' . 'webhookId' . '}', + ObjectSerializer::toPathValue($webhookId), $resourcePath ); } + // body params $_tempBody = null; if (isset($updateWebhook)) { $_tempBody = $updateWebhook; } + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + // for model (json/xml) if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present + // $_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); + } } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) + 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->apiClient->getApiKeyWithPrefix('api-key'); - if (strlen($apiKey) !== 0) { - $headerParams['api-key'] = $apiKey; + $apiKey = $this->config->getApiKeyWithPrefix('api-key'); + if ($apiKey !== null) { + $headers['api-key'] = $apiKey; } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, - 'PUT', - $queryParams, - $httpBody, - $headerParams, - null, - '/webhooks/{webhookId}' - ); - return [null, $statusCode, $httpHeader]; - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - case 404: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } - throw $e; + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } } + + return $options; } } diff --git a/lib/ApiClient.php b/lib/ApiClient.php deleted file mode 100644 index 07a0461e..00000000 --- a/lib/ApiClient.php +++ /dev/null @@ -1,371 +0,0 @@ -config = $config; - $this->serializer = new ObjectSerializer(); - } - - /** - * Get the config - * - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Get the serializer - * - * @return ObjectSerializer - */ - public function getSerializer() - { - return $this->serializer; - } - - /** - * Get API key (with prefix if set) - * - * @param string $apiKeyIdentifier name of apikey - * - * @return string API key with the prefix - */ - public function getApiKeyWithPrefix($apiKeyIdentifier) - { - $prefix = $this->config->getApiKeyPrefix($apiKeyIdentifier); - $apiKey = $this->config->getApiKey($apiKeyIdentifier); - - if (!isset($apiKey)) { - return null; - } - - if (isset($prefix)) { - $keyWithPrefix = $prefix." ".$apiKey; - } else { - $keyWithPrefix = $apiKey; - } - - return $keyWithPrefix; - } - - /** - * Make the HTTP call (Sync) - * - * @param string $resourcePath path to method endpoint - * @param string $method method to call - * @param array $queryParams parameters to be place in query URL - * @param array $postData parameters to be placed in POST body - * @param array $headerParams parameters to be place in request header - * @param string $responseType expected response type of the endpoint - * @param string $endpointPath path to method endpoint before expanding parameters - * - * @throws \SendinBlue\Client\ApiException on a non 2xx response - * @return mixed - */ - public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) - { - $headers = []; - - // construct the http header - $headerParams = array_merge( - (array)$this->config->getDefaultHeaders(), - (array)$headerParams - ); - - foreach ($headerParams as $key => $val) { - $headers[] = "$key: $val"; - } - - // form data - if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers, true)) { - $postData = http_build_query($postData); - } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers, true)) { // json model - $postData = json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($postData)); - } - - $url = $this->config->getHost() . $resourcePath; - - $curl = curl_init(); - // set timeout, if needed - if ($this->config->getCurlTimeout() !== 0) { - curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); - } - // set connect timeout, if needed - if ($this->config->getCurlConnectTimeout() != 0) { - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->config->getCurlConnectTimeout()); - } - - // return the result on success, rather than just true - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - - // disable SSL verification, if needed - if ($this->config->getSSLVerification() === false) { - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); - } - - if ($this->config->getCurlProxyHost()) { - curl_setopt($curl, CURLOPT_PROXY, $this->config->getCurlProxyHost()); - } - - if ($this->config->getCurlProxyPort()) { - curl_setopt($curl, CURLOPT_PROXYPORT, $this->config->getCurlProxyPort()); - } - - if ($this->config->getCurlProxyType()) { - curl_setopt($curl, CURLOPT_PROXYTYPE, $this->config->getCurlProxyType()); - } - - if ($this->config->getCurlProxyUser()) { - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->config->getCurlProxyUser() . ':' .$this->config->getCurlProxyPassword()); - } - - if (!empty($queryParams)) { - $url = ($url . '?' . http_build_query($queryParams)); - } - - if ($this->config->getAllowEncoding()) { - curl_setopt($curl, CURLOPT_ENCODING, ''); - } - - if ($method === self::$POST) { - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method === self::$HEAD) { - curl_setopt($curl, CURLOPT_NOBODY, true); - } elseif ($method === self::$OPTIONS) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method === self::$PATCH) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method === self::$PUT) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method === self::$DELETE) { - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); - } elseif ($method !== self::$GET) { - throw new ApiException('Method ' . $method . ' is not recognized.'); - } - curl_setopt($curl, CURLOPT_URL, $url); - - // Set user agent - curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent()); - - // debugging for curl - if ($this->config->getDebug()) { - error_log("[DEBUG] HTTP Request body ~BEGIN~".PHP_EOL.print_r($postData, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile()); - - curl_setopt($curl, CURLOPT_VERBOSE, 1); - curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a')); - } else { - curl_setopt($curl, CURLOPT_VERBOSE, 0); - } - - // obtain the HTTP response headers - curl_setopt($curl, CURLOPT_HEADER, 1); - - // Make the request - $response = curl_exec($curl); - $http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE); - $http_header = $this->httpParseHeaders(substr($response, 0, $http_header_size)); - $http_body = substr($response, $http_header_size); - $response_info = curl_getinfo($curl); - - // debug HTTP response body - if ($this->config->getDebug()) { - error_log("[DEBUG] HTTP Response body ~BEGIN~".PHP_EOL.print_r($http_body, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile()); - } - - // Handle the response - if ($response_info['http_code'] === 0) { - $curl_error_message = curl_error($curl); - - // curl_exec can sometimes fail but still return a blank message from curl_error(). - if (!empty($curl_error_message)) { - $error_message = "API call to $url failed: $curl_error_message"; - } else { - $error_message = "API call to $url failed, but for an unknown reason. " . - "This could happen if you are disconnected from the network."; - } - - $exception = new ApiException($error_message, 0, null, null); - $exception->setResponseObject($response_info); - throw $exception; - } elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) { - // return raw body if response is a file - if ($responseType === '\SplFileObject' || $responseType === 'string') { - return [$http_body, $response_info['http_code'], $http_header]; - } - - $data = json_decode($http_body); - if (json_last_error() > 0) { // if response is a string - $data = $http_body; - } - } else { - $data = json_decode($http_body); - if (json_last_error() > 0) { // if response is a string - $data = $http_body; - } - - throw new ApiException( - "[".$response_info['http_code']."] Error connecting to the API ($url)", - $response_info['http_code'], - $http_header, - $data - ); - } - return [$data, $response_info['http_code'], $http_header]; - } - - /** - * Return the header 'Accept' based on an array of Accept provided - * - * @param string[] $accept Array of header - * - * @return string Accept (e.g. application/json) - */ - public function selectHeaderAccept($accept) - { - if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) { - return null; - } elseif (preg_grep("/application\/json/i", $accept)) { - return 'application/json'; - } else { - return implode(',', $accept); - } - } - - /** - * Return the content type based on an array of content-type provided - * - * @param string[] $content_type Array fo content-type - * - * @return string Content-Type (e.g. application/json) - */ - public function selectHeaderContentType($content_type) - { - if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $content_type)) { - return 'application/json'; - } else { - return implode(',', $content_type); - } - } - - /** - * Return an array of HTTP response headers - * - * @param string $raw_headers A string of raw HTTP response headers - * - * @return string[] Array of HTTP response heaers - */ - protected function httpParseHeaders($raw_headers) - { - // ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986 - $headers = []; - $key = ''; - - foreach (explode("\n", $raw_headers) as $h) { - $h = explode(':', $h, 2); - - if (isset($h[1])) { - if (!isset($headers[$h[0]])) { - $headers[$h[0]] = trim($h[1]); - } elseif (is_array($headers[$h[0]])) { - $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); - } else { - $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); - } - - $key = $h[0]; - } else { - if (substr($h[0], 0, 1) === "\t") { - $headers[$key] .= "\r\n\t".trim($h[0]); - } elseif (!$key) { - $headers[0] = trim($h[0]); - } - trim($h[0]); - } - } - - return $headers; - } -} diff --git a/lib/ApiException.php b/lib/ApiException.php index e5fce860..ff45e00f 100644 --- a/lib/ApiException.php +++ b/lib/ApiException.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -51,7 +51,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[] + * @var string[]|null */ protected $responseHeaders; @@ -65,10 +65,10 @@ class ApiException extends Exception /** * Constructor * - * @param string $message Error message - * @param int $code HTTP status code - * @param string[] $responseHeaders HTTP response header - * @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string + * @param string $message Error message + * @param int $code HTTP status code + * @param string[]|null $responseHeaders HTTP response header + * @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) { @@ -80,7 +80,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[] HTTP response headers + * @return string[]|null HTTP response header */ public function getResponseHeaders() { diff --git a/lib/Configuration.php b/lib/Configuration.php index 791d6aa1..06d6bb5e 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -76,13 +76,6 @@ class Configuration */ protected $password = ''; - /** - * The default header(s) - * - * @var array - */ - protected $defaultHeaders = []; - /** * The host * @@ -90,20 +83,6 @@ class Configuration */ protected $host = 'https://api.sendinblue.com/v3'; - /** - * Timeout (second) of the HTTP request, by default set to 0, no timeout - * - * @var string - */ - protected $curlTimeout = 0; - - /** - * Timeout (second) of the HTTP connection, by default set to 0, no timeout - * - * @var string - */ - protected $curlConnectTimeout = 0; - /** * User agent of the HTTP request, set to "PHP-Swagger" by default * @@ -132,58 +111,6 @@ class Configuration */ protected $tempFolderPath; - /** - * Indicates if SSL verification should be enabled or disabled. - * - * This is useful if the host uses a self-signed SSL certificate. - * - * @var boolean True if the certificate should be validated, false otherwise. - */ - protected $sslVerification = true; - - /** - * Curl proxy host - * - * @var string - */ - protected $proxyHost; - - /** - * Curl proxy port - * - * @var integer - */ - protected $proxyPort; - - /** - * Curl proxy type, e.g. CURLPROXY_HTTP or CURLPROXY_SOCKS5 - * - * @see https://secure.php.net/manual/en/function.curl-setopt.php - * @var integer - */ - protected $proxyType; - - /** - * Curl proxy username - * - * @var string - */ - protected $proxyUser; - - /** - * Curl proxy password - * - * @var string - */ - protected $proxyPassword; - - /** - * Allow Curl encoding header - * - * @var bool - */ - protected $allowEncoding = false; - /** * Constructor */ @@ -313,48 +240,6 @@ public function getPassword() return $this->password; } - /** - * Adds a default header - * - * @param string $headerName header name (e.g. Token) - * @param string $headerValue header value (e.g. 1z8wp3) - * - * @throws \InvalidArgumentException - * @return $this - */ - public function addDefaultHeader($headerName, $headerValue) - { - if (!is_string($headerName)) { - throw new \InvalidArgumentException('Header name must be a string.'); - } - - $this->defaultHeaders[$headerName] = $headerValue; - return $this; - } - - /** - * Gets the default header - * - * @return array An array of default header(s) - */ - public function getDefaultHeaders() - { - return $this->defaultHeaders; - } - - /** - * Deletes a default header - * - * @param string $headerName the header to delete - * - * @return $this - */ - public function deleteDefaultHeader($headerName) - { - unset($this->defaultHeaders[$headerName]); - return $this; - } - /** * Sets the host * @@ -406,199 +291,6 @@ public function getUserAgent() return $this->userAgent; } - /** - * Sets the HTTP timeout value - * - * @param integer $seconds Number of seconds before timing out [set to 0 for no timeout] - * - * @throws \InvalidArgumentException - * @return $this - */ - public function setCurlTimeout($seconds) - { - if (!is_numeric($seconds) || $seconds < 0) { - throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.'); - } - - $this->curlTimeout = $seconds; - return $this; - } - - /** - * Gets the HTTP timeout value - * - * @return string HTTP timeout value - */ - public function getCurlTimeout() - { - return $this->curlTimeout; - } - - /** - * Sets the HTTP connect timeout value - * - * @param integer $seconds Number of seconds before connection times out [set to 0 for no timeout] - * - * @throws \InvalidArgumentException - * @return $this - */ - public function setCurlConnectTimeout($seconds) - { - if (!is_numeric($seconds) || $seconds < 0) { - throw new \InvalidArgumentException('Connect timeout value must be numeric and a non-negative number.'); - } - - $this->curlConnectTimeout = $seconds; - return $this; - } - - /** - * Set whether to accept encoding - * @param bool $allowEncoding - * - * @return $this - */ - public function setAllowEncoding($allowEncoding) - { - $this->allowEncoding = $allowEncoding; - return $this; - } - - /** - * Gets the HTTP connect timeout value - * - * @return string HTTP connect timeout value - */ - public function getCurlConnectTimeout() - { - return $this->curlConnectTimeout; - } - - /** - * Get whether to allow encoding - * - * @return bool - */ - public function getAllowEncoding() - { - return $this->allowEncoding; - } - - /** - * Sets the HTTP Proxy Host - * - * @param string $proxyHost HTTP Proxy URL - * - * @return $this - */ - public function setCurlProxyHost($proxyHost) - { - $this->proxyHost = $proxyHost; - return $this; - } - - /** - * Gets the HTTP Proxy Host - * - * @return string - */ - public function getCurlProxyHost() - { - return $this->proxyHost; - } - - /** - * Sets the HTTP Proxy Port - * - * @param integer $proxyPort HTTP Proxy Port - * - * @return $this - */ - public function setCurlProxyPort($proxyPort) - { - $this->proxyPort = $proxyPort; - return $this; - } - - /** - * Gets the HTTP Proxy Port - * - * @return integer - */ - public function getCurlProxyPort() - { - return $this->proxyPort; - } - - /** - * Sets the HTTP Proxy Type - * - * @param integer $proxyType HTTP Proxy Type - * - * @return $this - */ - public function setCurlProxyType($proxyType) - { - $this->proxyType = $proxyType; - return $this; - } - - /** - * Gets the HTTP Proxy Type - * - * @return integer - */ - public function getCurlProxyType() - { - return $this->proxyType; - } - - /** - * Sets the HTTP Proxy User - * - * @param string $proxyUser HTTP Proxy User - * - * @return $this - */ - public function setCurlProxyUser($proxyUser) - { - $this->proxyUser = $proxyUser; - return $this; - } - - /** - * Gets the HTTP Proxy User - * - * @return string - */ - public function getCurlProxyUser() - { - return $this->proxyUser; - } - - /** - * Sets the HTTP Proxy Password - * - * @param string $proxyPassword HTTP Proxy Password - * - * @return $this - */ - public function setCurlProxyPassword($proxyPassword) - { - $this->proxyPassword = $proxyPassword; - return $this; - } - - /** - * Gets the HTTP Proxy Password - * - * @return string - */ - public function getCurlProxyPassword() - { - return $this->proxyPassword; - } - /** * Sets debug flag * @@ -668,29 +360,6 @@ public function getTempFolderPath() return $this->tempFolderPath; } - /** - * Sets if SSL verification should be enabled or disabled - * - * @param boolean $sslVerification True if the certificate should be validated, false otherwise - * - * @return $this - */ - public function setSSLVerification($sslVerification) - { - $this->sslVerification = $sslVerification; - return $this; - } - - /** - * Gets if SSL verification should be enabled or disabled - * - * @return boolean True if the certificate should be validated, false otherwise - */ - public function getSSLVerification() - { - return $this->sslVerification; - } - /** * Gets the default configuration instance * @@ -732,4 +401,29 @@ public static function toDebugReport() return $report; } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } } diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php new file mode 100644 index 00000000..214dff62 --- /dev/null +++ b/lib/HeaderSelector.php @@ -0,0 +1,110 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + return $headers; + } + + /** + * @param string[] $accept + * @return array + */ + public function selectHeadersForMultipart($accept) + { + $headers = $this->selectHeaders($accept, []); + + unset($headers['Content-Type']); + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return string Accept (e.g. application/json) + */ + private function selectAcceptHeader($accept) + { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif (preg_grep("/application\/json/i", $accept)) { + return 'application/json'; + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $contentType Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + private function selectContentTypeHeader($contentType) + { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); + } + } +} + diff --git a/lib/Model/AddContactToList.php b/lib/Model/AddContactToList.php index 8bd1617d..673e1ed8 100644 --- a/lib/Model/AddContactToList.php +++ b/lib/Model/AddContactToList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * AddContactToList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class AddContactToList implements ArrayAccess +class AddContactToList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'addContactToList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class AddContactToList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'emails' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'emails' => 'emails' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'emails' => 'setEmails' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'emails' => 'getEmails' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets emails + * * @return string[] */ public function getEmails() @@ -171,7 +217,9 @@ public function getEmails() /** * Sets emails + * * @param string[] $emails Emails to add to a list + * * @return $this */ public function setEmails($emails) @@ -182,7 +230,9 @@ public function setEmails($emails) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/AddCredits.php b/lib/Model/AddCredits.php index 69e32339..1714ad18 100644 --- a/lib/Model/AddCredits.php +++ b/lib/Model/AddCredits.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * AddCredits Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class AddCredits implements ArrayAccess +class AddCredits implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'addCredits'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class AddCredits implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class AddCredits implements ArrayAccess 'email' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets sms + * * @return int */ public function getSms() @@ -177,7 +223,9 @@ public function getSms() /** * Sets sms + * * @param int $sms Required if email credits are empty. SMS credits to be added to the child account + * * @return $this */ public function setSms($sms) @@ -189,6 +237,7 @@ public function setSms($sms) /** * Gets email + * * @return int */ public function getEmail() @@ -198,7 +247,9 @@ public function getEmail() /** * Sets email + * * @param int $email Required if sms credits are empty. Email credits to be added to the child account + * * @return $this */ public function setEmail($email) @@ -209,7 +260,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateAttribute.php b/lib/Model/CreateAttribute.php index f0fae5c0..54cdae75 100644 --- a/lib/Model/CreateAttribute.php +++ b/lib/Model/CreateAttribute.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateAttribute Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateAttribute implements ArrayAccess +class CreateAttribute implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createAttribute'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class CreateAttribute implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class CreateAttribute implements ArrayAccess 'type' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'type' => 'type' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'type' => 'setType' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,21 +127,47 @@ public static function swaggerFormats() 'type' => 'getType' ]; + /** + * 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 TYPE_TEXT = 'text'; const TYPE_DATE = 'date'; const TYPE_FLOAT = 'float'; @@ -136,6 +178,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -152,13 +195,16 @@ public function getTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -168,27 +214,27 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -196,8 +242,8 @@ public function listInvalidProperties() public function valid() { - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } return true; @@ -206,6 +252,7 @@ public function valid() /** * Gets value + * * @return string */ public function getValue() @@ -215,7 +262,9 @@ public function getValue() /** * Sets value - * @param string $value Value of the attribute. Use only if the attribute's category is calculated or global + * + * @param string $value Value of the attribute. Use only if the attribute's category is 'calculated' or 'global' + * * @return $this */ public function setValue($value) @@ -227,6 +276,7 @@ public function setValue($value) /** * Gets enumeration + * * @return \SendinBlue\Client\Model\CreateAttributeEnumeration[] */ public function getEnumeration() @@ -236,7 +286,9 @@ public function getEnumeration() /** * Sets enumeration - * @param \SendinBlue\Client\Model\CreateAttributeEnumeration[] $enumeration Values that the attribute can take. Use only if the attribute's category is category + * + * @param \SendinBlue\Client\Model\CreateAttributeEnumeration[] $enumeration List of values and labels that the attribute can take. Use only if the attribute's category is \"category\". For example, [{'value':1, 'label':'male'}, {'value':2, 'label':'female'}] + * * @return $this */ public function setEnumeration($enumeration) @@ -248,6 +300,7 @@ public function setEnumeration($enumeration) /** * Gets type + * * @return string */ public function getType() @@ -257,17 +310,19 @@ public function getType() /** * Sets type - * @param string $type Type of the attribute. Use only if the attribute's category is normal, category or transactional ( type 'id' only available if the category is 'transactional' attribute & type 'category' only available if the category is 'category' attribute ) + * + * @param string $type Type of the attribute. Use only if the attribute's category is 'normal', 'category' or 'transactional' ( type 'id' is only available if the category is 'transactional' attribute & type 'category' is only available if the category is 'category' attribute ) + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -277,7 +332,9 @@ public function setType($type) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -287,7 +344,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -297,8 +356,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -312,7 +373,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -322,15 +385,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateAttributeEnumeration.php b/lib/Model/CreateAttributeEnumeration.php index 7dfa436a..fad0af87 100644 --- a/lib/Model/CreateAttributeEnumeration.php +++ b/lib/Model/CreateAttributeEnumeration.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateAttributeEnumeration Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateAttributeEnumeration implements ArrayAccess +class CreateAttributeEnumeration implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createAttribute_enumeration'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class CreateAttributeEnumeration implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class CreateAttributeEnumeration implements ArrayAccess 'label' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'label' => 'label' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'label' => 'setLabel' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'label' => 'getLabel' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['value'] === null) { - $invalid_properties[] = "'value' can't be null"; + $invalidProperties[] = "'value' can't be null"; } if ($this->container['label'] === null) { - $invalid_properties[] = "'label' can't be null"; + $invalidProperties[] = "'label' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets value + * * @return int */ public function getValue() @@ -189,7 +235,9 @@ public function getValue() /** * Sets value + * * @param int $value Id of the value + * * @return $this */ public function setValue($value) @@ -201,6 +249,7 @@ public function setValue($value) /** * Gets label + * * @return string */ public function getLabel() @@ -210,7 +259,9 @@ public function getLabel() /** * Sets label + * * @param string $label Label of the value + * * @return $this */ public function setLabel($label) @@ -221,7 +272,9 @@ public function setLabel($label) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateChild.php b/lib/Model/CreateChild.php index 50b324df..5e5c9807 100644 --- a/lib/Model/CreateChild.php +++ b/lib/Model/CreateChild.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateChild Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateChild implements ArrayAccess +class CreateChild implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createChild'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class CreateChild implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class CreateChild implements ArrayAccess 'password' => 'password' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'password' => 'password' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'password' => 'setPassword' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,34 +137,63 @@ public static function swaggerFormats() 'password' => 'getPassword' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -160,34 +205,34 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['firstName'] === null) { - $invalid_properties[] = "'firstName' can't be null"; + $invalidProperties[] = "'firstName' can't be null"; } if ($this->container['lastName'] === null) { - $invalid_properties[] = "'lastName' can't be null"; + $invalidProperties[] = "'lastName' can't be null"; } if ($this->container['companyName'] === null) { - $invalid_properties[] = "'companyName' can't be null"; + $invalidProperties[] = "'companyName' can't be null"; } if ($this->container['password'] === null) { - $invalid_properties[] = "'password' can't be null"; + $invalidProperties[] = "'password' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -216,6 +261,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -225,7 +271,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email address to create the child account + * * @return $this */ public function setEmail($email) @@ -237,6 +285,7 @@ public function setEmail($email) /** * Gets firstName + * * @return string */ public function getFirstName() @@ -246,7 +295,9 @@ public function getFirstName() /** * Sets firstName + * * @param string $firstName First name to use to create the child account + * * @return $this */ public function setFirstName($firstName) @@ -258,6 +309,7 @@ public function setFirstName($firstName) /** * Gets lastName + * * @return string */ public function getLastName() @@ -267,7 +319,9 @@ public function getLastName() /** * Sets lastName + * * @param string $lastName Last name to use to create the child account + * * @return $this */ public function setLastName($lastName) @@ -279,6 +333,7 @@ public function setLastName($lastName) /** * Gets companyName + * * @return string */ public function getCompanyName() @@ -288,7 +343,9 @@ public function getCompanyName() /** * Sets companyName + * * @param string $companyName Company name to use to create the child account + * * @return $this */ public function setCompanyName($companyName) @@ -300,6 +357,7 @@ public function setCompanyName($companyName) /** * Gets password + * * @return string */ public function getPassword() @@ -309,7 +367,9 @@ public function getPassword() /** * Sets password + * * @param string $password Password for the child account to login + * * @return $this */ public function setPassword($password) @@ -320,7 +380,9 @@ public function setPassword($password) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -330,7 +392,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -340,8 +404,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -355,7 +421,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -365,15 +433,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateContact.php b/lib/Model/CreateContact.php index fda96d76..3fd1ad78 100644 --- a/lib/Model/CreateContact.php +++ b/lib/Model/CreateContact.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateContact Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateContact implements ArrayAccess +class CreateContact implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createContact'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -65,6 +68,7 @@ class CreateContact implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -77,18 +81,30 @@ class CreateContact implements ArrayAccess 'smtpBlacklistSender' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -101,9 +117,9 @@ public static function swaggerFormats() 'smtpBlacklistSender' => 'smtpBlacklistSender' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -116,9 +132,9 @@ public static function swaggerFormats() 'smtpBlacklistSender' => 'setSmtpBlacklistSender' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -131,34 +147,63 @@ public static function swaggerFormats() 'smtpBlacklistSender' => 'getSmtpBlacklistSender' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -172,19 +217,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -198,6 +243,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -207,7 +253,9 @@ public function getEmail() /** * Sets email - * @param string $email Email address of the user. Mandatory if `attributes.sms` is not passed + * + * @param string $email Email address of the user. Mandatory if \"sms\" field is not passed in \"attributes\" parameter' + * * @return $this */ public function setEmail($email) @@ -219,6 +267,7 @@ public function setEmail($email) /** * Gets attributes + * * @return object */ public function getAttributes() @@ -228,7 +277,9 @@ public function getAttributes() /** * Sets attributes - * @param object $attributes Values of the attributes to fill. The attributes must exist in you contact database + * + * @param object $attributes Pass the set of attributes and their values. These attributes must be present in your SendinBlue account. For eg. {'FNAME':'Elly', 'LNAME':'Roger'} + * * @return $this */ public function setAttributes($attributes) @@ -240,6 +291,7 @@ public function setAttributes($attributes) /** * Gets emailBlacklisted + * * @return bool */ public function getEmailBlacklisted() @@ -249,7 +301,9 @@ public function getEmailBlacklisted() /** * Sets emailBlacklisted - * @param bool $emailBlacklisted Blacklist the contact for emails (emailBlacklisted = true) + * + * @param bool $emailBlacklisted Set this field to blacklist the contact for emails (emailBlacklisted = true) + * * @return $this */ public function setEmailBlacklisted($emailBlacklisted) @@ -261,6 +315,7 @@ public function setEmailBlacklisted($emailBlacklisted) /** * Gets smsBlacklisted + * * @return bool */ public function getSmsBlacklisted() @@ -270,7 +325,9 @@ public function getSmsBlacklisted() /** * Sets smsBlacklisted - * @param bool $smsBlacklisted Blacklist the contact for SMS (smsBlacklisted = true) + * + * @param bool $smsBlacklisted Set this field to blacklist the contact for SMS (smsBlacklisted = true) + * * @return $this */ public function setSmsBlacklisted($smsBlacklisted) @@ -282,6 +339,7 @@ public function setSmsBlacklisted($smsBlacklisted) /** * Gets listIds + * * @return int[] */ public function getListIds() @@ -291,7 +349,9 @@ public function getListIds() /** * Sets listIds + * * @param int[] $listIds Ids of the lists to add the contact to + * * @return $this */ public function setListIds($listIds) @@ -303,6 +363,7 @@ public function setListIds($listIds) /** * Gets updateEnabled + * * @return bool */ public function getUpdateEnabled() @@ -312,7 +373,9 @@ public function getUpdateEnabled() /** * Sets updateEnabled - * @param bool $updateEnabled Facilitate to update existing contact in same request (updateEnabled = true) + * + * @param bool $updateEnabled Facilitate to update the existing contact in the same request (updateEnabled = true) + * * @return $this */ public function setUpdateEnabled($updateEnabled) @@ -324,6 +387,7 @@ public function setUpdateEnabled($updateEnabled) /** * Gets smtpBlacklistSender + * * @return string[] */ public function getSmtpBlacklistSender() @@ -333,7 +397,9 @@ public function getSmtpBlacklistSender() /** * Sets smtpBlacklistSender + * * @param string[] $smtpBlacklistSender SMTP forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true ) + * * @return $this */ public function setSmtpBlacklistSender($smtpBlacklistSender) @@ -344,7 +410,9 @@ public function setSmtpBlacklistSender($smtpBlacklistSender) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -354,7 +422,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -364,8 +434,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -379,7 +451,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -389,15 +463,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateEmailCampaign.php b/lib/Model/CreateEmailCampaign.php index f4992830..4d73f248 100644 --- a/lib/Model/CreateEmailCampaign.php +++ b/lib/Model/CreateEmailCampaign.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateEmailCampaign Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateEmailCampaign implements ArrayAccess +class CreateEmailCampaign implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createEmailCampaign'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -76,6 +79,7 @@ class CreateEmailCampaign implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -99,18 +103,30 @@ class CreateEmailCampaign implements ArrayAccess 'utmCampaign' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -134,9 +150,9 @@ public static function swaggerFormats() 'utmCampaign' => 'utmCampaign' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -160,9 +176,9 @@ public static function swaggerFormats() 'utmCampaign' => 'setUtmCampaign' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -186,21 +202,47 @@ public static function swaggerFormats() 'utmCampaign' => 'getUtmCampaign' ]; + /** + * 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 TYPE_CLASSIC = 'classic'; const TYPE_TRIGGER = 'trigger'; @@ -208,6 +250,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -221,13 +264,16 @@ public function getTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -252,36 +298,39 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; + } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['subject'] === null) { - $invalid_properties[] = "'subject' can't be null"; + $invalidProperties[] = "'subject' can't be null"; } if ($this->container['type'] === null) { - $invalid_properties[] = "'type' can't be null"; + $invalidProperties[] = "'type' can't be null"; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -289,6 +338,9 @@ public function listInvalidProperties() public function valid() { + if ($this->container['sender'] === null) { + return false; + } if ($this->container['name'] === null) { return false; } @@ -298,8 +350,8 @@ public function valid() if ($this->container['type'] === null) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } return true; @@ -308,6 +360,7 @@ public function valid() /** * Gets tag + * * @return string */ public function getTag() @@ -317,7 +370,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the campaign + * * @return $this */ public function setTag($tag) @@ -329,6 +384,7 @@ public function setTag($tag) /** * Gets sender + * * @return \SendinBlue\Client\Model\CreateEmailCampaignSender */ public function getSender() @@ -338,7 +394,9 @@ public function getSender() /** * Sets sender - * @param \SendinBlue\Client\Model\CreateEmailCampaignSender $sender + * + * @param \SendinBlue\Client\Model\CreateEmailCampaignSender $sender sender + * * @return $this */ public function setSender($sender) @@ -350,6 +408,7 @@ public function setSender($sender) /** * Gets name + * * @return string */ public function getName() @@ -359,7 +418,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the campaign + * * @return $this */ public function setName($name) @@ -371,6 +432,7 @@ public function setName($name) /** * Gets htmlContent + * * @return string */ public function getHtmlContent() @@ -380,7 +442,9 @@ public function getHtmlContent() /** * Sets htmlContent + * * @param string $htmlContent Mandatory if htmlUrl is empty. Body of the message (HTML) + * * @return $this */ public function setHtmlContent($htmlContent) @@ -392,6 +456,7 @@ public function setHtmlContent($htmlContent) /** * Gets htmlUrl + * * @return string */ public function getHtmlUrl() @@ -401,7 +466,9 @@ public function getHtmlUrl() /** * Sets htmlUrl + * * @param string $htmlUrl Mandatory if htmlContent is empty. Url to the message (HTML) + * * @return $this */ public function setHtmlUrl($htmlUrl) @@ -413,6 +480,7 @@ public function setHtmlUrl($htmlUrl) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -422,7 +490,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt Sending UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -434,6 +504,7 @@ public function setScheduledAt($scheduledAt) /** * Gets subject + * * @return string */ public function getSubject() @@ -443,7 +514,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the campaign + * * @return $this */ public function setSubject($subject) @@ -455,6 +528,7 @@ public function setSubject($subject) /** * Gets replyTo + * * @return string */ public function getReplyTo() @@ -464,7 +538,9 @@ public function getReplyTo() /** * Sets replyTo + * * @param string $replyTo Email on which the campaign recipients will be able to reply to + * * @return $this */ public function setReplyTo($replyTo) @@ -476,6 +552,7 @@ public function setReplyTo($replyTo) /** * Gets toField + * * @return string */ public function getToField() @@ -485,7 +562,9 @@ public function getToField() /** * Sets toField + * * @param string $toField To personalize the «To» Field, e.g. if you want to include the first name and last name of your recipient, use {FNAME} {LNAME}. These attributes must already exist in your contact database + * * @return $this */ public function setToField($toField) @@ -497,6 +576,7 @@ public function setToField($toField) /** * Gets recipients + * * @return \SendinBlue\Client\Model\CreateEmailCampaignRecipients */ public function getRecipients() @@ -506,7 +586,9 @@ public function getRecipients() /** * Sets recipients - * @param \SendinBlue\Client\Model\CreateEmailCampaignRecipients $recipients + * + * @param \SendinBlue\Client\Model\CreateEmailCampaignRecipients $recipients recipients + * * @return $this */ public function setRecipients($recipients) @@ -518,6 +600,7 @@ public function setRecipients($recipients) /** * Gets attachmentUrl + * * @return string */ public function getAttachmentUrl() @@ -527,7 +610,9 @@ public function getAttachmentUrl() /** * Sets attachmentUrl + * * @param string $attachmentUrl Absolute url of the attachment (no local file). Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps + * * @return $this */ public function setAttachmentUrl($attachmentUrl) @@ -539,6 +624,7 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets inlineImageActivation + * * @return bool */ public function getInlineImageActivation() @@ -548,7 +634,9 @@ public function getInlineImageActivation() /** * Sets inlineImageActivation + * * @param bool $inlineImageActivation Use true to embedded the images in your email. Final size of the email should be less than 4MB. Campaigns with embedded images can not be sent to more than 5000 contacts + * * @return $this */ public function setInlineImageActivation($inlineImageActivation) @@ -560,6 +648,7 @@ public function setInlineImageActivation($inlineImageActivation) /** * Gets mirrorActive + * * @return bool */ public function getMirrorActive() @@ -569,7 +658,9 @@ public function getMirrorActive() /** * Sets mirrorActive + * * @param bool $mirrorActive Use true to enable the mirror link + * * @return $this */ public function setMirrorActive($mirrorActive) @@ -581,6 +672,7 @@ public function setMirrorActive($mirrorActive) /** * Gets recurring + * * @return bool */ public function getRecurring() @@ -590,7 +682,9 @@ public function getRecurring() /** * Sets recurring + * * @param bool $recurring For trigger campagins use false to make sure a contact receives the same campaign only once + * * @return $this */ public function setRecurring($recurring) @@ -602,6 +696,7 @@ public function setRecurring($recurring) /** * Gets type + * * @return string */ public function getType() @@ -611,17 +706,19 @@ public function getType() /** * Sets type + * * @param string $type Type of the campaign + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -632,6 +729,7 @@ public function setType($type) /** * Gets footer + * * @return string */ public function getFooter() @@ -641,7 +739,9 @@ public function getFooter() /** * Sets footer + * * @param string $footer Footer of the email campaign + * * @return $this */ public function setFooter($footer) @@ -653,6 +753,7 @@ public function setFooter($footer) /** * Gets header + * * @return string */ public function getHeader() @@ -662,7 +763,9 @@ public function getHeader() /** * Sets header + * * @param string $header Header of the email campaign + * * @return $this */ public function setHeader($header) @@ -674,6 +777,7 @@ public function setHeader($header) /** * Gets utmCampaign + * * @return string */ public function getUtmCampaign() @@ -683,7 +787,9 @@ public function getUtmCampaign() /** * Sets utmCampaign + * * @param string $utmCampaign Customize the utm_campaign value. If this field is empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed + * * @return $this */ public function setUtmCampaign($utmCampaign) @@ -694,7 +800,9 @@ public function setUtmCampaign($utmCampaign) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -704,7 +812,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -714,8 +824,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -729,7 +841,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -739,15 +853,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateEmailCampaignRecipients.php b/lib/Model/CreateEmailCampaignRecipients.php index 3a418b50..eb831456 100644 --- a/lib/Model/CreateEmailCampaignRecipients.php +++ b/lib/Model/CreateEmailCampaignRecipients.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateEmailCampaignRecipients Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description List ids to include/exclude from campaign + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateEmailCampaignRecipients implements ArrayAccess +class CreateEmailCampaignRecipients implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createEmailCampaign_recipients'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +64,7 @@ class CreateEmailCampaignRecipients implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +72,30 @@ class CreateEmailCampaignRecipients implements ArrayAccess 'listIds' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +103,9 @@ public static function swaggerFormats() 'listIds' => 'listIds' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +113,9 @@ public static function swaggerFormats() 'listIds' => 'setListIds' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +123,63 @@ public static function swaggerFormats() 'listIds' => 'getListIds' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +188,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +214,7 @@ public function valid() /** * Gets exclusionListIds + * * @return int[] */ public function getExclusionListIds() @@ -177,7 +224,9 @@ public function getExclusionListIds() /** * Sets exclusionListIds + * * @param int[] $exclusionListIds List ids to exclude from the campaign + * * @return $this */ public function setExclusionListIds($exclusionListIds) @@ -189,6 +238,7 @@ public function setExclusionListIds($exclusionListIds) /** * Gets listIds + * * @return int[] */ public function getListIds() @@ -198,7 +248,9 @@ public function getListIds() /** * Sets listIds + * * @param int[] $listIds Mandatory if scheduledAt is not empty. List Ids to send the campaign to + * * @return $this */ public function setListIds($listIds) @@ -209,7 +261,9 @@ public function setListIds($listIds) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +273,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +285,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +302,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +314,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateEmailCampaignSender.php b/lib/Model/CreateEmailCampaignSender.php index 6f46233b..567e66f7 100644 --- a/lib/Model/CreateEmailCampaignSender.php +++ b/lib/Model/CreateEmailCampaignSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateEmailCampaignSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description Sender details including email and name (optional). For example {'name':'xyz' , 'email':'example@abc.com'} + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateEmailCampaignSender implements ArrayAccess +class CreateEmailCampaignSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createEmailCampaign_sender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +64,7 @@ class CreateEmailCampaignSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +72,30 @@ class CreateEmailCampaignSender implements ArrayAccess 'email' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +103,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +113,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +123,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +188,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +220,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -183,7 +230,9 @@ public function getName() /** * Sets name + * * @param string $name Sender Name + * * @return $this */ public function setName($name) @@ -195,6 +244,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -204,7 +254,9 @@ public function getEmail() /** * Sets email + * * @param string $email Sender email + * * @return $this */ public function setEmail($email) @@ -215,7 +267,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +279,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +291,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +308,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +320,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateList.php b/lib/Model/CreateList.php index ef23e6bd..f3698d9d 100644 --- a/lib/Model/CreateList.php +++ b/lib/Model/CreateList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateList implements ArrayAccess +class CreateList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class CreateList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class CreateList implements ArrayAccess 'folderId' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'folderId' => 'folderId' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'folderId' => 'setFolderId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'folderId' => 'getFolderId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['folderId'] === null) { - $invalid_properties[] = "'folderId' can't be null"; + $invalidProperties[] = "'folderId' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -189,7 +235,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the list + * * @return $this */ public function setName($name) @@ -201,6 +249,7 @@ public function setName($name) /** * Gets folderId + * * @return int */ public function getFolderId() @@ -210,7 +259,9 @@ public function getFolderId() /** * Sets folderId - * @param int $folderId Id of the folder in which to create the list + * + * @param int $folderId Id of the parent folder in which this list is to be created + * * @return $this */ public function setFolderId($folderId) @@ -221,7 +272,9 @@ public function setFolderId($folderId) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateModel.php b/lib/Model/CreateModel.php index c294e931..15a1cf40 100644 --- a/lib/Model/CreateModel.php +++ b/lib/Model/CreateModel.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateModel Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateModel implements ArrayAccess +class CreateModel implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createModel'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class CreateModel implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'id' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'id' => 'id' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'id' => 'setId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'id' => 'getId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -177,7 +223,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the object created + * * @return $this */ public function setId($id) @@ -188,7 +236,9 @@ public function setId($id) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateReseller.php b/lib/Model/CreateReseller.php index 4bf6904b..b384daa3 100644 --- a/lib/Model/CreateReseller.php +++ b/lib/Model/CreateReseller.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateReseller Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateReseller implements ArrayAccess +class CreateReseller implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createReseller'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class CreateReseller implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'authKey' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'authKey' => 'authKey' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'authKey' => 'setAuthKey' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'authKey' => 'getAuthKey' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['authKey'] === null) { - $invalid_properties[] = "'authKey' can't be null"; + $invalidProperties[] = "'authKey' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets authKey + * * @return string */ public function getAuthKey() @@ -177,7 +223,9 @@ public function getAuthKey() /** * Sets authKey + * * @param string $authKey AuthKey of Reseller child created + * * @return $this */ public function setAuthKey($authKey) @@ -188,7 +236,9 @@ public function setAuthKey($authKey) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateSender.php b/lib/Model/CreateSender.php index 9d86f8a9..87cb01e4 100644 --- a/lib/Model/CreateSender.php +++ b/lib/Model/CreateSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateSender implements ArrayAccess +class CreateSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createSender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class CreateSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class CreateSender implements ArrayAccess 'ips' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'ips' => 'ips' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'ips' => 'setIps' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'ips' => 'getIps' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,25 +193,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -186,6 +231,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -195,7 +241,9 @@ public function getName() /** * Sets name + * * @param string $name From Name to use for the sender + * * @return $this */ public function setName($name) @@ -207,6 +255,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -216,7 +265,9 @@ public function getEmail() /** * Sets email + * * @param string $email From Email to use for the sender + * * @return $this */ public function setEmail($email) @@ -228,6 +279,7 @@ public function setEmail($email) /** * Gets ips + * * @return \SendinBlue\Client\Model\CreateSenderIps[] */ public function getIps() @@ -237,7 +289,9 @@ public function getIps() /** * Sets ips + * * @param \SendinBlue\Client\Model\CreateSenderIps[] $ips Mandatory in case of dedicated IP, IPs to associate to the sender + * * @return $this */ public function setIps($ips) @@ -248,7 +302,9 @@ public function setIps($ips) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -258,7 +314,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -268,8 +326,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -283,7 +343,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -293,15 +355,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateSenderIps.php b/lib/Model/CreateSenderIps.php index 777dfa8b..82b885ba 100644 --- a/lib/Model/CreateSenderIps.php +++ b/lib/Model/CreateSenderIps.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateSenderIps Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateSenderIps implements ArrayAccess +class CreateSenderIps implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createSender_ips'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class CreateSenderIps implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class CreateSenderIps implements ArrayAccess 'weight' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'weight' => 'weight' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'weight' => 'setWeight' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'weight' => 'getWeight' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,33 +193,33 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } if ($this->container['domain'] === null) { - $invalid_properties[] = "'domain' can't be null"; + $invalidProperties[] = "'domain' can't be null"; } if (!is_null($this->container['weight']) && ($this->container['weight'] > 100)) { - $invalid_properties[] = "invalid value for 'weight', must be smaller than or equal to 100."; + $invalidProperties[] = "invalid value for 'weight', must be smaller than or equal to 100."; } if (!is_null($this->container['weight']) && ($this->container['weight'] < 1)) { - $invalid_properties[] = "invalid value for 'weight', must be bigger than or equal to 1."; + $invalidProperties[] = "invalid value for 'weight', must be bigger than or equal to 1."; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -200,6 +245,7 @@ public function valid() /** * Gets ip + * * @return string */ public function getIp() @@ -209,7 +255,9 @@ public function getIp() /** * Sets ip + * * @param string $ip Dedicated IP available in your account + * * @return $this */ public function setIp($ip) @@ -221,6 +269,7 @@ public function setIp($ip) /** * Gets domain + * * @return string */ public function getDomain() @@ -230,7 +279,9 @@ public function getDomain() /** * Sets domain + * * @param string $domain Domain of the IP + * * @return $this */ public function setDomain($domain) @@ -242,6 +293,7 @@ public function setDomain($domain) /** * Gets weight + * * @return int */ public function getWeight() @@ -251,7 +303,9 @@ public function getWeight() /** * Sets weight + * * @param int $weight Weight to apply to the IP. Sum of all IP weights must be 100. Should be passed for either ALL or NONE of the IPs. If it's not passed, the sending will be equally balanced on all IPs. + * * @return $this */ public function setWeight($weight) @@ -270,7 +324,9 @@ public function setWeight($weight) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -280,7 +336,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -290,8 +348,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -305,7 +365,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -315,15 +377,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateSenderModel.php b/lib/Model/CreateSenderModel.php index 6915865a..597078b3 100644 --- a/lib/Model/CreateSenderModel.php +++ b/lib/Model/CreateSenderModel.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateSenderModel Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateSenderModel implements ArrayAccess +class CreateSenderModel implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createSenderModel'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class CreateSenderModel implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class CreateSenderModel implements ArrayAccess 'dkimError' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'dkimError' => 'dkimError' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'dkimError' => 'setDkimError' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'dkimError' => 'getDkimError' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,22 +193,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -189,7 +235,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the Sender created + * * @return $this */ public function setId($id) @@ -201,6 +249,7 @@ public function setId($id) /** * Gets spfError + * * @return bool */ public function getSpfError() @@ -210,7 +259,9 @@ public function getSpfError() /** * Sets spfError + * * @param bool $spfError Status of SPF configuration for the sender (true = SPF not well configured, false = SPF well configured) + * * @return $this */ public function setSpfError($spfError) @@ -222,6 +273,7 @@ public function setSpfError($spfError) /** * Gets dkimError + * * @return bool */ public function getDkimError() @@ -231,7 +283,9 @@ public function getDkimError() /** * Sets dkimError + * * @param bool $dkimError Status of DKIM configuration for the sender (true = DKIM not well configured, false = DKIM well configured) + * * @return $this */ public function setDkimError($dkimError) @@ -242,7 +296,9 @@ public function setDkimError($dkimError) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -252,7 +308,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -262,8 +320,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -277,7 +337,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -287,15 +349,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateSmsCampaign.php b/lib/Model/CreateSmsCampaign.php index 1b06d187..184feb5d 100644 --- a/lib/Model/CreateSmsCampaign.php +++ b/lib/Model/CreateSmsCampaign.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateSmsCampaign Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateSmsCampaign implements ArrayAccess +class CreateSmsCampaign implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createSmsCampaign'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class CreateSmsCampaign implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class CreateSmsCampaign implements ArrayAccess 'scheduledAt' => 'date-time' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'scheduledAt' => 'scheduledAt' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'scheduledAt' => 'setScheduledAt' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,34 +137,63 @@ public static function swaggerFormats() 'scheduledAt' => 'getScheduledAt' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -160,29 +205,29 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['sender'] === null) { - $invalid_properties[] = "'sender' can't be null"; + $invalidProperties[] = "'sender' can't be null"; } if ((strlen($this->container['sender']) > 11)) { - $invalid_properties[] = "invalid value for 'sender', the character length must be smaller than or equal to 11."; + $invalidProperties[] = "invalid value for 'sender', the character length must be smaller than or equal to 11."; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -205,6 +250,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -214,7 +260,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the campaign + * * @return $this */ public function setName($name) @@ -226,6 +274,7 @@ public function setName($name) /** * Gets sender + * * @return string */ public function getSender() @@ -235,7 +284,9 @@ public function getSender() /** * Sets sender + * * @param string $sender Name of the sender. The number of characters is limited to 11 + * * @return $this */ public function setSender($sender) @@ -251,6 +302,7 @@ public function setSender($sender) /** * Gets content + * * @return string */ public function getContent() @@ -260,7 +312,9 @@ public function getContent() /** * Sets content + * * @param string $content Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS + * * @return $this */ public function setContent($content) @@ -272,6 +326,7 @@ public function setContent($content) /** * Gets recipients + * * @return \SendinBlue\Client\Model\CreateSmsCampaignRecipients */ public function getRecipients() @@ -281,7 +336,9 @@ public function getRecipients() /** * Sets recipients - * @param \SendinBlue\Client\Model\CreateSmsCampaignRecipients $recipients + * + * @param \SendinBlue\Client\Model\CreateSmsCampaignRecipients $recipients recipients + * * @return $this */ public function setRecipients($recipients) @@ -293,6 +350,7 @@ public function setRecipients($recipients) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -302,7 +360,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -313,7 +373,9 @@ public function setScheduledAt($scheduledAt) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -323,7 +385,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -333,8 +397,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -348,7 +414,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -358,15 +426,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateSmsCampaignRecipients.php b/lib/Model/CreateSmsCampaignRecipients.php index 8d4c5d67..7e500598 100644 --- a/lib/Model/CreateSmsCampaignRecipients.php +++ b/lib/Model/CreateSmsCampaignRecipients.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateSmsCampaignRecipients Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateSmsCampaignRecipients implements ArrayAccess +class CreateSmsCampaignRecipients implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createSmsCampaign_recipients'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class CreateSmsCampaignRecipients implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class CreateSmsCampaignRecipients implements ArrayAccess 'exclusionListIds' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'exclusionListIds' => 'exclusionListIds' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'exclusionListIds' => 'setExclusionListIds' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'exclusionListIds' => 'getExclusionListIds' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['listIds'] === null) { - $invalid_properties[] = "'listIds' can't be null"; + $invalidProperties[] = "'listIds' can't be null"; } if ($this->container['exclusionListIds'] === null) { - $invalid_properties[] = "'exclusionListIds' can't be null"; + $invalidProperties[] = "'exclusionListIds' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets listIds + * * @return int[] */ public function getListIds() @@ -189,7 +235,9 @@ public function getListIds() /** * Sets listIds + * * @param int[] $listIds Lists Ids to send the campaign to. REQUIRED if scheduledAt is not empty + * * @return $this */ public function setListIds($listIds) @@ -201,6 +249,7 @@ public function setListIds($listIds) /** * Gets exclusionListIds + * * @return int[] */ public function getExclusionListIds() @@ -210,7 +259,9 @@ public function getExclusionListIds() /** * Sets exclusionListIds + * * @param int[] $exclusionListIds List ids which have to be excluded from a campaign + * * @return $this */ public function setExclusionListIds($exclusionListIds) @@ -221,7 +272,9 @@ public function setExclusionListIds($exclusionListIds) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateSmtpEmail.php b/lib/Model/CreateSmtpEmail.php index 276fb3e1..63a4d013 100644 --- a/lib/Model/CreateSmtpEmail.php +++ b/lib/Model/CreateSmtpEmail.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateSmtpEmail Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateSmtpEmail implements ArrayAccess +class CreateSmtpEmail implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createSmtpEmail'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class CreateSmtpEmail implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'messageId' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'messageId' => 'messageId' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'messageId' => 'setMessageId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'messageId' => 'getMessageId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['messageId'] === null) { - $invalid_properties[] = "'messageId' can't be null"; + $invalidProperties[] = "'messageId' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets messageId + * * @return string */ public function getMessageId() @@ -177,7 +223,9 @@ public function getMessageId() /** * Sets messageId + * * @param string $messageId Message ID of the SMTP Email sent + * * @return $this */ public function setMessageId($messageId) @@ -188,7 +236,9 @@ public function setMessageId($messageId) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateSmtpTemplate.php b/lib/Model/CreateSmtpTemplate.php index c229f4aa..0cc65ec8 100644 --- a/lib/Model/CreateSmtpTemplate.php +++ b/lib/Model/CreateSmtpTemplate.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateSmtpTemplate Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateSmtpTemplate implements ArrayAccess +class CreateSmtpTemplate implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createSmtpTemplate'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -68,6 +71,7 @@ class CreateSmtpTemplate implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -83,18 +87,30 @@ class CreateSmtpTemplate implements ArrayAccess 'isActive' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -110,9 +126,9 @@ public static function swaggerFormats() 'isActive' => 'isActive' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -128,9 +144,9 @@ public static function swaggerFormats() 'isActive' => 'setIsActive' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -146,34 +162,63 @@ public static function swaggerFormats() 'isActive' => 'getIsActive' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -190,25 +235,28 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; + } if ($this->container['templateName'] === null) { - $invalid_properties[] = "'templateName' can't be null"; + $invalidProperties[] = "'templateName' can't be null"; } if ($this->container['subject'] === null) { - $invalid_properties[] = "'subject' can't be null"; + $invalidProperties[] = "'subject' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -216,6 +264,9 @@ public function listInvalidProperties() public function valid() { + if ($this->container['sender'] === null) { + return false; + } if ($this->container['templateName'] === null) { return false; } @@ -228,6 +279,7 @@ public function valid() /** * Gets tag + * * @return string */ public function getTag() @@ -237,7 +289,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the template + * * @return $this */ public function setTag($tag) @@ -249,6 +303,7 @@ public function setTag($tag) /** * Gets sender + * * @return \SendinBlue\Client\Model\CreateSmtpTemplateSender */ public function getSender() @@ -258,7 +313,9 @@ public function getSender() /** * Sets sender - * @param \SendinBlue\Client\Model\CreateSmtpTemplateSender $sender + * + * @param \SendinBlue\Client\Model\CreateSmtpTemplateSender $sender sender + * * @return $this */ public function setSender($sender) @@ -270,6 +327,7 @@ public function setSender($sender) /** * Gets templateName + * * @return string */ public function getTemplateName() @@ -279,7 +337,9 @@ public function getTemplateName() /** * Sets templateName + * * @param string $templateName Name of the template + * * @return $this */ public function setTemplateName($templateName) @@ -291,6 +351,7 @@ public function setTemplateName($templateName) /** * Gets htmlContent + * * @return string */ public function getHtmlContent() @@ -300,7 +361,9 @@ public function getHtmlContent() /** * Sets htmlContent + * * @param string $htmlContent Body of the message (HTML version). The field must have more than 10 characters. REQUIRED if htmlUrl is empty + * * @return $this */ public function setHtmlContent($htmlContent) @@ -312,6 +375,7 @@ public function setHtmlContent($htmlContent) /** * Gets htmlUrl + * * @return string */ public function getHtmlUrl() @@ -321,7 +385,9 @@ public function getHtmlUrl() /** * Sets htmlUrl + * * @param string $htmlUrl Url which contents the body of the email message. REQUIRED if htmlContent is empty + * * @return $this */ public function setHtmlUrl($htmlUrl) @@ -333,6 +399,7 @@ public function setHtmlUrl($htmlUrl) /** * Gets subject + * * @return string */ public function getSubject() @@ -342,7 +409,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the template + * * @return $this */ public function setSubject($subject) @@ -354,6 +423,7 @@ public function setSubject($subject) /** * Gets replyTo + * * @return string */ public function getReplyTo() @@ -363,7 +433,9 @@ public function getReplyTo() /** * Sets replyTo + * * @param string $replyTo Email on which campaign recipients will be able to reply to + * * @return $this */ public function setReplyTo($replyTo) @@ -375,6 +447,7 @@ public function setReplyTo($replyTo) /** * Gets toField + * * @return string */ public function getToField() @@ -384,7 +457,9 @@ public function getToField() /** * Sets toField + * * @param string $toField This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. To use the contact attributes here, these must already exist in SendinBlue account + * * @return $this */ public function setToField($toField) @@ -396,6 +471,7 @@ public function setToField($toField) /** * Gets attachmentUrl + * * @return string */ public function getAttachmentUrl() @@ -405,7 +481,9 @@ public function getAttachmentUrl() /** * Sets attachmentUrl + * * @param string $attachmentUrl Absolute url of the attachment (no local file). Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps + * * @return $this */ public function setAttachmentUrl($attachmentUrl) @@ -417,6 +495,7 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets isActive + * * @return bool */ public function getIsActive() @@ -426,7 +505,9 @@ public function getIsActive() /** * Sets isActive + * * @param bool $isActive Status of template. isActive = true means template is active and isActive = false means template is inactive + * * @return $this */ public function setIsActive($isActive) @@ -437,7 +518,9 @@ public function setIsActive($isActive) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -447,7 +530,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -457,8 +542,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -472,7 +559,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -482,15 +571,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateSmtpTemplateSender.php b/lib/Model/CreateSmtpTemplateSender.php index b7160b7e..9e97638a 100644 --- a/lib/Model/CreateSmtpTemplateSender.php +++ b/lib/Model/CreateSmtpTemplateSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateSmtpTemplateSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description Sender details including email and name (optional). For example {'name':'xyz' , 'email':'example@abc.com'} + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateSmtpTemplateSender implements ArrayAccess +class CreateSmtpTemplateSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createSmtpTemplate_sender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +64,7 @@ class CreateSmtpTemplateSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +72,30 @@ class CreateSmtpTemplateSender implements ArrayAccess 'email' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +103,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +113,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +123,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +188,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +220,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -183,7 +230,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the sender. If not passed, will be set to default + * * @return $this */ public function setName($name) @@ -195,6 +244,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -204,7 +254,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email of the sender + * * @return $this */ public function setEmail($email) @@ -215,7 +267,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +279,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +291,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +308,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +320,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateUpdateFolder.php b/lib/Model/CreateUpdateFolder.php index 37ed7eb3..e51e62a3 100644 --- a/lib/Model/CreateUpdateFolder.php +++ b/lib/Model/CreateUpdateFolder.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateUpdateFolder Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateUpdateFolder implements ArrayAccess +class CreateUpdateFolder implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createUpdateFolder'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class CreateUpdateFolder implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'name' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'name' => 'name' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'name' => 'setName' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'name' => 'getName' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -171,7 +217,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the folder + * * @return $this */ public function setName($name) @@ -182,7 +230,9 @@ public function setName($name) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreateWebhook.php b/lib/Model/CreateWebhook.php index c99c361d..f605943f 100644 --- a/lib/Model/CreateWebhook.php +++ b/lib/Model/CreateWebhook.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreateWebhook Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreateWebhook implements ArrayAccess +class CreateWebhook implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createWebhook'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class CreateWebhook implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class CreateWebhook implements ArrayAccess 'type' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'type' => 'type' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'type' => 'setType' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,21 +132,47 @@ public static function swaggerFormats() 'type' => 'getType' ]; + /** + * 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 EVENTS_HARD_BOUNCE = 'hardBounce'; const EVENTS_SOFT_BOUNCE = 'softBounce'; const EVENTS_BLOCKED = 'blocked'; @@ -151,6 +193,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getEventsAllowableValues() @@ -174,6 +217,7 @@ public function getEventsAllowableValues() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -187,13 +231,16 @@ public function getTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -204,30 +251,30 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['url'] === null) { - $invalid_properties[] = "'url' can't be null"; + $invalidProperties[] = "'url' can't be null"; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -238,8 +285,8 @@ public function valid() if ($this->container['url'] === null) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } return true; @@ -248,6 +295,7 @@ public function valid() /** * Gets url + * * @return string */ public function getUrl() @@ -257,7 +305,9 @@ public function getUrl() /** * Sets url + * * @param string $url URL of the webhook + * * @return $this */ public function setUrl($url) @@ -269,6 +319,7 @@ public function setUrl($url) /** * Gets description + * * @return string */ public function getDescription() @@ -278,7 +329,9 @@ public function getDescription() /** * Sets description + * * @param string $description Description of the webhook + * * @return $this */ public function setDescription($description) @@ -290,6 +343,7 @@ public function setDescription($description) /** * Gets events + * * @return string[] */ public function getEvents() @@ -299,17 +353,19 @@ public function getEvents() /** * Sets events + * * @param string[] $events Events triggering the webhook. Possible values for Transactional type webhook – request, delivered, hardBounce, softBounce, blocked, spam, invalid, deferred, click, opened, uniqueOpened and unsubscribed and possible values for Marketing type webhook – spam, opened, click, hardBounce, softBounce, unsubscribed, listAddition & delivered + * * @return $this */ public function setEvents($events) { - $allowed_values = $this->getEventsAllowableValues(); - if (!is_null($events) && array_diff($events, $allowed_values)) { + $allowedValues = $this->getEventsAllowableValues(); + if (!is_null($events) && array_diff($events, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'events', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -320,6 +376,7 @@ public function setEvents($events) /** * Gets type + * * @return string */ public function getType() @@ -329,17 +386,19 @@ public function getType() /** * Sets type + * * @param string $type Type of the webhook + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -349,7 +408,9 @@ public function setType($type) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -359,7 +420,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -369,8 +432,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -384,7 +449,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -394,15 +461,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/CreatedProcessId.php b/lib/Model/CreatedProcessId.php index 367a53ec..dcf6ecf2 100644 --- a/lib/Model/CreatedProcessId.php +++ b/lib/Model/CreatedProcessId.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * CreatedProcessId Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class CreatedProcessId implements ArrayAccess +class CreatedProcessId implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'createdProcessId'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class CreatedProcessId implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'processId' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'processId' => 'processId' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'processId' => 'setProcessId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'processId' => 'getProcessId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['processId'] === null) { - $invalid_properties[] = "'processId' can't be null"; + $invalidProperties[] = "'processId' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets processId + * * @return int */ public function getProcessId() @@ -177,7 +223,9 @@ public function getProcessId() /** * Sets processId + * * @param int $processId Id of the process created + * * @return $this */ public function setProcessId($processId) @@ -188,7 +236,9 @@ public function setProcessId($processId) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/DeleteHardbounces.php b/lib/Model/DeleteHardbounces.php index 7723a8f9..fdde0955 100644 --- a/lib/Model/DeleteHardbounces.php +++ b/lib/Model/DeleteHardbounces.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * DeleteHardbounces Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class DeleteHardbounces implements ArrayAccess +class DeleteHardbounces implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'deleteHardbounces'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class DeleteHardbounces implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class DeleteHardbounces implements ArrayAccess 'contactEmail' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'contactEmail' => 'contactEmail' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'contactEmail' => 'setContactEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'contactEmail' => 'getContactEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,19 +193,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets startDate + * * @return \DateTime */ public function getStartDate() @@ -183,7 +229,9 @@ public function getStartDate() /** * Sets startDate - * @param \DateTime $startDate Starting date (YYYY-MM-DD) of the period from which the hardbounces will be deleted. Must be lower than equal to endDate + * + * @param \DateTime $startDate Starting date (YYYY-MM-DD) of the time period for deletion. The hardbounces occurred after this date will be deleted. Must be less than or equal to the endDate + * * @return $this */ public function setStartDate($startDate) @@ -195,6 +243,7 @@ public function setStartDate($startDate) /** * Gets endDate + * * @return \DateTime */ public function getEndDate() @@ -204,7 +253,9 @@ public function getEndDate() /** * Sets endDate - * @param \DateTime $endDate Ending date (YYYY-MM-DD) of the period from which the hardbounces will be deleted. Must be greater than equal to startDate + * + * @param \DateTime $endDate Ending date (YYYY-MM-DD) of the time period for deletion. The hardbounces until this date will be deleted. Must be greater than or equal to the startDate + * * @return $this */ public function setEndDate($endDate) @@ -216,6 +267,7 @@ public function setEndDate($endDate) /** * Gets contactEmail + * * @return string */ public function getContactEmail() @@ -225,7 +277,9 @@ public function getContactEmail() /** * Sets contactEmail + * * @param string $contactEmail Target a specific email address + * * @return $this */ public function setContactEmail($contactEmail) @@ -236,7 +290,9 @@ public function setContactEmail($contactEmail) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -246,7 +302,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -256,8 +314,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -271,7 +331,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -281,15 +343,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/EmailExportRecipients.php b/lib/Model/EmailExportRecipients.php index 14d5fe79..f092a178 100644 --- a/lib/Model/EmailExportRecipients.php +++ b/lib/Model/EmailExportRecipients.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * EmailExportRecipients Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class EmailExportRecipients implements ArrayAccess +class EmailExportRecipients implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'emailExportRecipients'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class EmailExportRecipients implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class EmailExportRecipients implements ArrayAccess 'recipientsType' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'recipientsType' => 'recipientsType' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'recipientsType' => 'setRecipientsType' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,21 +122,47 @@ public static function swaggerFormats() 'recipientsType' => 'getRecipientsType' ]; + /** + * 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 RECIPIENTS_TYPE_ALL = 'all'; const RECIPIENTS_TYPE_NON_CLICKERS = 'nonClickers'; const RECIPIENTS_TYPE_NON_OPENERS = 'nonOpeners'; @@ -134,6 +176,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getRecipientsTypeAllowableValues() @@ -153,13 +196,16 @@ public function getRecipientsTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -168,30 +214,30 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['recipientsType'] === null) { - $invalid_properties[] = "'recipientsType' can't be null"; + $invalidProperties[] = "'recipientsType' can't be null"; } - $allowed_values = $this->getRecipientsTypeAllowableValues(); - if (!in_array($this->container['recipientsType'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getRecipientsTypeAllowableValues(); + if (!in_array($this->container['recipientsType'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'recipientsType', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -202,8 +248,8 @@ public function valid() if ($this->container['recipientsType'] === null) { return false; } - $allowed_values = $this->getRecipientsTypeAllowableValues(); - if (!in_array($this->container['recipientsType'], $allowed_values)) { + $allowedValues = $this->getRecipientsTypeAllowableValues(); + if (!in_array($this->container['recipientsType'], $allowedValues)) { return false; } return true; @@ -212,6 +258,7 @@ public function valid() /** * Gets notifyURL + * * @return string */ public function getNotifyURL() @@ -221,7 +268,9 @@ public function getNotifyURL() /** * Sets notifyURL + * * @param string $notifyURL Webhook called once the export process is finished + * * @return $this */ public function setNotifyURL($notifyURL) @@ -233,6 +282,7 @@ public function setNotifyURL($notifyURL) /** * Gets recipientsType + * * @return string */ public function getRecipientsType() @@ -242,17 +292,19 @@ public function getRecipientsType() /** * Sets recipientsType + * * @param string $recipientsType Type of recipients to export for a campaign + * * @return $this */ public function setRecipientsType($recipientsType) { - $allowed_values = $this->getRecipientsTypeAllowableValues(); - if (!in_array($recipientsType, $allowed_values)) { + $allowedValues = $this->getRecipientsTypeAllowableValues(); + if (!in_array($recipientsType, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'recipientsType', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -262,7 +314,9 @@ public function setRecipientsType($recipientsType) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -272,7 +326,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -282,8 +338,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -297,7 +355,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -307,15 +367,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/ErrorModel.php b/lib/Model/ErrorModel.php index 1142028b..4c98fb51 100644 --- a/lib/Model/ErrorModel.php +++ b/lib/Model/ErrorModel.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * ErrorModel Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class ErrorModel implements ArrayAccess +class ErrorModel implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'errorModel'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class ErrorModel implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class ErrorModel implements ArrayAccess 'message' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'message' => 'message' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'message' => 'setMessage' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,21 +122,47 @@ public static function swaggerFormats() 'message' => 'getMessage' ]; + /** + * 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 CODE_INVALID_PARAMETER = 'invalid_parameter'; const CODE_MISSING_PARAMETER = 'missing_parameter'; const CODE_OUT_OF_RANGE = 'out_of_range'; @@ -141,6 +183,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getCodeAllowableValues() @@ -167,13 +210,16 @@ public function getCodeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -182,33 +228,33 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['code'] === null) { - $invalid_properties[] = "'code' can't be null"; + $invalidProperties[] = "'code' can't be null"; } - $allowed_values = $this->getCodeAllowableValues(); - if (!in_array($this->container['code'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($this->container['code'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'code', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['message'] === null) { - $invalid_properties[] = "'message' can't be null"; + $invalidProperties[] = "'message' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -219,8 +265,8 @@ public function valid() if ($this->container['code'] === null) { return false; } - $allowed_values = $this->getCodeAllowableValues(); - if (!in_array($this->container['code'], $allowed_values)) { + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($this->container['code'], $allowedValues)) { return false; } if ($this->container['message'] === null) { @@ -232,6 +278,7 @@ public function valid() /** * Gets code + * * @return string */ public function getCode() @@ -241,17 +288,19 @@ public function getCode() /** * Sets code + * * @param string $code Error code displayed in case of a failure + * * @return $this */ public function setCode($code) { - $allowed_values = $this->getCodeAllowableValues(); - if (!in_array($code, $allowed_values)) { + $allowedValues = $this->getCodeAllowableValues(); + if (!in_array($code, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'code', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -262,6 +311,7 @@ public function setCode($code) /** * Gets message + * * @return string */ public function getMessage() @@ -271,7 +321,9 @@ public function getMessage() /** * Sets message + * * @param string $message Readable message associated to the failure + * * @return $this */ public function setMessage($message) @@ -282,7 +334,9 @@ public function setMessage($message) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -292,7 +346,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -302,8 +358,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -317,7 +375,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -327,15 +387,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAccount.php b/lib/Model/GetAccount.php index c022c91e..cb9dd7a2 100644 --- a/lib/Model/GetAccount.php +++ b/lib/Model/GetAccount.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAccount Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAccount implements ArrayAccess +class GetAccount implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAccount'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -66,6 +69,7 @@ class GetAccount implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -79,18 +83,30 @@ class GetAccount implements ArrayAccess 'marketingAutomation' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'marketingAutomation' => 'marketingAutomation' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -120,9 +136,9 @@ public static function swaggerFormats() 'marketingAutomation' => 'setMarketingAutomation' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -136,34 +152,63 @@ public static function swaggerFormats() 'marketingAutomation' => 'getMarketingAutomation' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -178,34 +223,40 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['firstName'] === null) { - $invalid_properties[] = "'firstName' can't be null"; + $invalidProperties[] = "'firstName' can't be null"; } if ($this->container['lastName'] === null) { - $invalid_properties[] = "'lastName' can't be null"; + $invalidProperties[] = "'lastName' can't be null"; } if ($this->container['companyName'] === null) { - $invalid_properties[] = "'companyName' can't be null"; + $invalidProperties[] = "'companyName' can't be null"; + } + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; } if ($this->container['plan'] === null) { - $invalid_properties[] = "'plan' can't be null"; + $invalidProperties[] = "'plan' can't be null"; + } + if ($this->container['relay'] === null) { + $invalidProperties[] = "'relay' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -225,15 +276,22 @@ public function valid() if ($this->container['companyName'] === null) { return false; } + if ($this->container['address'] === null) { + return false; + } if ($this->container['plan'] === null) { return false; } + if ($this->container['relay'] === null) { + return false; + } return true; } /** * Gets email + * * @return string */ public function getEmail() @@ -243,7 +301,9 @@ public function getEmail() /** * Sets email + * * @param string $email Login Email + * * @return $this */ public function setEmail($email) @@ -255,6 +315,7 @@ public function setEmail($email) /** * Gets firstName + * * @return string */ public function getFirstName() @@ -264,7 +325,9 @@ public function getFirstName() /** * Sets firstName + * * @param string $firstName First Name + * * @return $this */ public function setFirstName($firstName) @@ -276,6 +339,7 @@ public function setFirstName($firstName) /** * Gets lastName + * * @return string */ public function getLastName() @@ -285,7 +349,9 @@ public function getLastName() /** * Sets lastName + * * @param string $lastName Last Name + * * @return $this */ public function setLastName($lastName) @@ -297,6 +363,7 @@ public function setLastName($lastName) /** * Gets companyName + * * @return string */ public function getCompanyName() @@ -306,7 +373,9 @@ public function getCompanyName() /** * Sets companyName + * * @param string $companyName Name of the company + * * @return $this */ public function setCompanyName($companyName) @@ -318,6 +387,7 @@ public function setCompanyName($companyName) /** * Gets address + * * @return \SendinBlue\Client\Model\GetExtendedClientAddress */ public function getAddress() @@ -327,7 +397,9 @@ public function getAddress() /** * Sets address - * @param \SendinBlue\Client\Model\GetExtendedClientAddress $address + * + * @param \SendinBlue\Client\Model\GetExtendedClientAddress $address address + * * @return $this */ public function setAddress($address) @@ -339,6 +411,7 @@ public function setAddress($address) /** * Gets plan + * * @return \SendinBlue\Client\Model\GetAccountPlan[] */ public function getPlan() @@ -348,7 +421,9 @@ public function getPlan() /** * Sets plan + * * @param \SendinBlue\Client\Model\GetAccountPlan[] $plan Information about your plans and credits + * * @return $this */ public function setPlan($plan) @@ -360,6 +435,7 @@ public function setPlan($plan) /** * Gets relay + * * @return \SendinBlue\Client\Model\GetAccountRelay */ public function getRelay() @@ -369,7 +445,9 @@ public function getRelay() /** * Sets relay - * @param \SendinBlue\Client\Model\GetAccountRelay $relay + * + * @param \SendinBlue\Client\Model\GetAccountRelay $relay relay + * * @return $this */ public function setRelay($relay) @@ -381,6 +459,7 @@ public function setRelay($relay) /** * Gets marketingAutomation + * * @return \SendinBlue\Client\Model\GetAccountMarketingAutomation */ public function getMarketingAutomation() @@ -390,7 +469,9 @@ public function getMarketingAutomation() /** * Sets marketingAutomation - * @param \SendinBlue\Client\Model\GetAccountMarketingAutomation $marketingAutomation + * + * @param \SendinBlue\Client\Model\GetAccountMarketingAutomation $marketingAutomation marketingAutomation + * * @return $this */ public function setMarketingAutomation($marketingAutomation) @@ -401,7 +482,9 @@ public function setMarketingAutomation($marketingAutomation) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -411,7 +494,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -421,8 +506,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -436,7 +523,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -446,15 +535,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAccountMarketingAutomation.php b/lib/Model/GetAccountMarketingAutomation.php index c1b55621..a5721b23 100644 --- a/lib/Model/GetAccountMarketingAutomation.php +++ b/lib/Model/GetAccountMarketingAutomation.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAccountMarketingAutomation Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAccountMarketingAutomation implements ArrayAccess +class GetAccountMarketingAutomation implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAccount_marketingAutomation'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetAccountMarketingAutomation implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetAccountMarketingAutomation implements ArrayAccess 'enabled' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'enabled' => 'enabled' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'enabled' => 'setEnabled' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'enabled' => 'getEnabled' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +187,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['enabled'] === null) { - $invalid_properties[] = "'enabled' can't be null"; + $invalidProperties[] = "'enabled' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets key + * * @return string */ public function getKey() @@ -183,7 +229,9 @@ public function getKey() /** * Sets key + * * @param string $key Marketing Automation Tracker ID + * * @return $this */ public function setKey($key) @@ -195,6 +243,7 @@ public function setKey($key) /** * Gets enabled + * * @return bool */ public function getEnabled() @@ -204,7 +253,9 @@ public function getEnabled() /** * Sets enabled + * * @param bool $enabled Status of Marketing Automation Plateform activation for your account (true=enabled, false=disabled) + * * @return $this */ public function setEnabled($enabled) @@ -215,7 +266,9 @@ public function setEnabled($enabled) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +278,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +307,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +319,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAccountPlan.php b/lib/Model/GetAccountPlan.php index f0c86ad5..df25b787 100644 --- a/lib/Model/GetAccountPlan.php +++ b/lib/Model/GetAccountPlan.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAccountPlan Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAccountPlan implements ArrayAccess +class GetAccountPlan implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAccount_plan'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -64,6 +67,7 @@ class GetAccountPlan implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -75,18 +79,30 @@ class GetAccountPlan implements ArrayAccess 'userLimit' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -98,9 +114,9 @@ public static function swaggerFormats() 'userLimit' => 'userLimit' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -112,9 +128,9 @@ public static function swaggerFormats() 'userLimit' => 'setUserLimit' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -126,23 +142,48 @@ public static function swaggerFormats() 'userLimit' => 'getUserLimit' ]; + /** + * 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 TYPE_PAY_AS_YOU_GO = 'payAsYouGo'; - const TYPE_UNLIMITED = 'unlimited'; const TYPE_FREE = 'free'; const TYPE_SUBSCRIPTION = 'subscription'; const TYPE_SMS = 'sms'; @@ -153,13 +194,13 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() { return [ self::TYPE_PAY_AS_YOU_GO, - self::TYPE_UNLIMITED, self::TYPE_FREE, self::TYPE_SUBSCRIPTION, self::TYPE_SMS, @@ -169,6 +210,7 @@ public function getTypeAllowableValues() /** * Gets allowable values of the enum + * * @return string[] */ public function getCreditsTypeAllowableValues() @@ -181,13 +223,16 @@ public function getCreditsTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -200,44 +245,44 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['type'] === null) { - $invalid_properties[] = "'type' can't be null"; + $invalidProperties[] = "'type' can't be null"; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['creditsType'] === null) { - $invalid_properties[] = "'creditsType' can't be null"; + $invalidProperties[] = "'creditsType' can't be null"; } - $allowed_values = $this->getCreditsTypeAllowableValues(); - if (!in_array($this->container['creditsType'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getCreditsTypeAllowableValues(); + if (!in_array($this->container['creditsType'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'creditsType', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['credits'] === null) { - $invalid_properties[] = "'credits' can't be null"; + $invalidProperties[] = "'credits' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -248,15 +293,15 @@ public function valid() if ($this->container['type'] === null) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } if ($this->container['creditsType'] === null) { return false; } - $allowed_values = $this->getCreditsTypeAllowableValues(); - if (!in_array($this->container['creditsType'], $allowed_values)) { + $allowedValues = $this->getCreditsTypeAllowableValues(); + if (!in_array($this->container['creditsType'], $allowedValues)) { return false; } if ($this->container['credits'] === null) { @@ -268,6 +313,7 @@ public function valid() /** * Gets type + * * @return string */ public function getType() @@ -277,17 +323,19 @@ public function getType() /** * Sets type + * * @param string $type Displays the plan type of the user + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -298,6 +346,7 @@ public function setType($type) /** * Gets creditsType + * * @return string */ public function getCreditsType() @@ -307,17 +356,19 @@ public function getCreditsType() /** * Sets creditsType + * * @param string $creditsType This is the type of the credit, \"Send Limit\" is one of the possible types of credit of a user. \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. + * * @return $this */ public function setCreditsType($creditsType) { - $allowed_values = $this->getCreditsTypeAllowableValues(); - if (!in_array($creditsType, $allowed_values)) { + $allowedValues = $this->getCreditsTypeAllowableValues(); + if (!in_array($creditsType, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'creditsType', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -328,6 +379,7 @@ public function setCreditsType($creditsType) /** * Gets credits + * * @return float */ public function getCredits() @@ -337,7 +389,9 @@ public function getCredits() /** * Sets credits + * * @param float $credits Remaining credits of the user + * * @return $this */ public function setCredits($credits) @@ -349,6 +403,7 @@ public function setCredits($credits) /** * Gets startDate + * * @return \DateTime */ public function getStartDate() @@ -358,7 +413,9 @@ public function getStartDate() /** * Sets startDate - * @param \DateTime $startDate Date of the period from which the plan will start (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) + * + * @param \DateTime $startDate Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type) + * * @return $this */ public function setStartDate($startDate) @@ -370,6 +427,7 @@ public function setStartDate($startDate) /** * Gets endDate + * * @return \DateTime */ public function getEndDate() @@ -379,7 +437,9 @@ public function getEndDate() /** * Sets endDate - * @param \DateTime $endDate Date of the period from which the plan will end (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) + * + * @param \DateTime $endDate Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type) + * * @return $this */ public function setEndDate($endDate) @@ -391,6 +451,7 @@ public function setEndDate($endDate) /** * Gets userLimit + * * @return int */ public function getUserLimit() @@ -400,7 +461,9 @@ public function getUserLimit() /** * Sets userLimit + * * @param int $userLimit Only in case of reseller account. It implies the total number of child accounts you can add to your account. + * * @return $this */ public function setUserLimit($userLimit) @@ -411,7 +474,9 @@ public function setUserLimit($userLimit) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -421,7 +486,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -431,8 +498,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -446,7 +515,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -456,15 +527,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAccountRelay.php b/lib/Model/GetAccountRelay.php index d016c23f..61ae084d 100644 --- a/lib/Model/GetAccountRelay.php +++ b/lib/Model/GetAccountRelay.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAccountRelay Class Doc Comment * - * @category Class + * @category Class * @description Information about your SMTP account - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAccountRelay implements ArrayAccess +class GetAccountRelay implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAccount_relay'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class GetAccountRelay implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -68,18 +72,30 @@ class GetAccountRelay implements ArrayAccess 'data' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -87,9 +103,9 @@ public static function swaggerFormats() 'data' => 'data' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -97,9 +113,9 @@ public static function swaggerFormats() 'data' => 'setData' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -107,34 +123,63 @@ public static function swaggerFormats() 'data' => 'getData' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -143,22 +188,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['enabled'] === null) { - $invalid_properties[] = "'enabled' can't be null"; + $invalidProperties[] = "'enabled' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -169,12 +217,16 @@ public function valid() if ($this->container['enabled'] === null) { return false; } + if ($this->container['data'] === null) { + return false; + } return true; } /** * Gets enabled + * * @return bool */ public function getEnabled() @@ -184,7 +236,9 @@ public function getEnabled() /** * Sets enabled + * * @param bool $enabled Status of your SMTP Account (true=Enabled, false=Disabled) + * * @return $this */ public function setEnabled($enabled) @@ -196,6 +250,7 @@ public function setEnabled($enabled) /** * Gets data + * * @return \SendinBlue\Client\Model\GetAccountRelayData */ public function getData() @@ -205,7 +260,9 @@ public function getData() /** * Sets data - * @param \SendinBlue\Client\Model\GetAccountRelayData $data + * + * @param \SendinBlue\Client\Model\GetAccountRelayData $data data + * * @return $this */ public function setData($data) @@ -216,7 +273,9 @@ public function setData($data) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -226,7 +285,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -236,8 +297,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -251,7 +314,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -261,15 +326,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAccountRelayData.php b/lib/Model/GetAccountRelayData.php index a42f9ea5..07beaf0d 100644 --- a/lib/Model/GetAccountRelayData.php +++ b/lib/Model/GetAccountRelayData.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAccountRelayData Class Doc Comment * - * @category Class + * @category Class * @description Data regarding the SMTP account - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAccountRelayData implements ArrayAccess +class GetAccountRelayData implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAccount_relay_data'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetAccountRelayData implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -70,18 +74,30 @@ class GetAccountRelayData implements ArrayAccess 'port' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -90,9 +106,9 @@ public static function swaggerFormats() 'port' => 'port' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -101,9 +117,9 @@ public static function swaggerFormats() 'port' => 'setPort' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -112,34 +128,63 @@ public static function swaggerFormats() 'port' => 'getPort' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -149,28 +194,28 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['userName'] === null) { - $invalid_properties[] = "'userName' can't be null"; + $invalidProperties[] = "'userName' can't be null"; } if ($this->container['relay'] === null) { - $invalid_properties[] = "'relay' can't be null"; + $invalidProperties[] = "'relay' can't be null"; } if ($this->container['port'] === null) { - $invalid_properties[] = "'port' can't be null"; + $invalidProperties[] = "'port' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -193,6 +238,7 @@ public function valid() /** * Gets userName + * * @return string */ public function getUserName() @@ -202,7 +248,9 @@ public function getUserName() /** * Sets userName + * * @param string $userName Email to use as login on SMTP + * * @return $this */ public function setUserName($userName) @@ -214,6 +262,7 @@ public function setUserName($userName) /** * Gets relay + * * @return string */ public function getRelay() @@ -223,7 +272,9 @@ public function getRelay() /** * Sets relay + * * @param string $relay URL of the SMTP Relay + * * @return $this */ public function setRelay($relay) @@ -235,6 +286,7 @@ public function setRelay($relay) /** * Gets port + * * @return int */ public function getPort() @@ -244,7 +296,9 @@ public function getPort() /** * Sets port + * * @param int $port Port used for SMTP Relay + * * @return $this */ public function setPort($port) @@ -255,7 +309,9 @@ public function setPort($port) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -265,7 +321,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -275,8 +333,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -290,7 +350,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -300,15 +362,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAggregatedReport.php b/lib/Model/GetAggregatedReport.php index 655b00b3..98cc3519 100644 --- a/lib/Model/GetAggregatedReport.php +++ b/lib/Model/GetAggregatedReport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAggregatedReport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAggregatedReport implements ArrayAccess +class GetAggregatedReport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAggregatedReport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -70,6 +73,7 @@ class GetAggregatedReport implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -87,18 +91,30 @@ class GetAggregatedReport implements ArrayAccess 'invalid' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -116,9 +132,9 @@ public static function swaggerFormats() 'invalid' => 'invalid' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -136,9 +152,9 @@ public static function swaggerFormats() 'invalid' => 'setInvalid' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -156,34 +172,63 @@ public static function swaggerFormats() 'invalid' => 'getInvalid' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -202,55 +247,55 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['range'] === null) { - $invalid_properties[] = "'range' can't be null"; + $invalidProperties[] = "'range' can't be null"; } if ($this->container['requests'] === null) { - $invalid_properties[] = "'requests' can't be null"; + $invalidProperties[] = "'requests' can't be null"; } if ($this->container['delivered'] === null) { - $invalid_properties[] = "'delivered' can't be null"; + $invalidProperties[] = "'delivered' can't be null"; } if ($this->container['hardBounces'] === null) { - $invalid_properties[] = "'hardBounces' can't be null"; + $invalidProperties[] = "'hardBounces' can't be null"; } if ($this->container['softBounces'] === null) { - $invalid_properties[] = "'softBounces' can't be null"; + $invalidProperties[] = "'softBounces' can't be null"; } if ($this->container['clicks'] === null) { - $invalid_properties[] = "'clicks' can't be null"; + $invalidProperties[] = "'clicks' can't be null"; } if ($this->container['uniqueClicks'] === null) { - $invalid_properties[] = "'uniqueClicks' can't be null"; + $invalidProperties[] = "'uniqueClicks' can't be null"; } if ($this->container['opens'] === null) { - $invalid_properties[] = "'opens' can't be null"; + $invalidProperties[] = "'opens' can't be null"; } if ($this->container['uniqueOpens'] === null) { - $invalid_properties[] = "'uniqueOpens' can't be null"; + $invalidProperties[] = "'uniqueOpens' can't be null"; } if ($this->container['spamReports'] === null) { - $invalid_properties[] = "'spamReports' can't be null"; + $invalidProperties[] = "'spamReports' can't be null"; } if ($this->container['blocked'] === null) { - $invalid_properties[] = "'blocked' can't be null"; + $invalidProperties[] = "'blocked' can't be null"; } if ($this->container['invalid'] === null) { - $invalid_properties[] = "'invalid' can't be null"; + $invalidProperties[] = "'invalid' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -300,6 +345,7 @@ public function valid() /** * Gets range + * * @return string */ public function getRange() @@ -309,7 +355,9 @@ public function getRange() /** * Sets range + * * @param string $range Time frame of the report + * * @return $this */ public function setRange($range) @@ -321,6 +369,7 @@ public function setRange($range) /** * Gets requests + * * @return int */ public function getRequests() @@ -330,7 +379,9 @@ public function getRequests() /** * Sets requests + * * @param int $requests Number of requests for the timeframe + * * @return $this */ public function setRequests($requests) @@ -342,6 +393,7 @@ public function setRequests($requests) /** * Gets delivered + * * @return int */ public function getDelivered() @@ -351,7 +403,9 @@ public function getDelivered() /** * Sets delivered + * * @param int $delivered Number of delivered emails for the timeframe + * * @return $this */ public function setDelivered($delivered) @@ -363,6 +417,7 @@ public function setDelivered($delivered) /** * Gets hardBounces + * * @return int */ public function getHardBounces() @@ -372,7 +427,9 @@ public function getHardBounces() /** * Sets hardBounces + * * @param int $hardBounces Number of hardbounces for the timeframe + * * @return $this */ public function setHardBounces($hardBounces) @@ -384,6 +441,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces + * * @return int */ public function getSoftBounces() @@ -393,7 +451,9 @@ public function getSoftBounces() /** * Sets softBounces + * * @param int $softBounces Number of softbounces for the timeframe + * * @return $this */ public function setSoftBounces($softBounces) @@ -405,6 +465,7 @@ public function setSoftBounces($softBounces) /** * Gets clicks + * * @return int */ public function getClicks() @@ -414,7 +475,9 @@ public function getClicks() /** * Sets clicks + * * @param int $clicks Number of clicks for the timeframe + * * @return $this */ public function setClicks($clicks) @@ -426,6 +489,7 @@ public function setClicks($clicks) /** * Gets uniqueClicks + * * @return int */ public function getUniqueClicks() @@ -435,7 +499,9 @@ public function getUniqueClicks() /** * Sets uniqueClicks + * * @param int $uniqueClicks Number of unique clicks for the timeframe + * * @return $this */ public function setUniqueClicks($uniqueClicks) @@ -447,6 +513,7 @@ public function setUniqueClicks($uniqueClicks) /** * Gets opens + * * @return int */ public function getOpens() @@ -456,7 +523,9 @@ public function getOpens() /** * Sets opens + * * @param int $opens Number of openings for the timeframe + * * @return $this */ public function setOpens($opens) @@ -468,6 +537,7 @@ public function setOpens($opens) /** * Gets uniqueOpens + * * @return int */ public function getUniqueOpens() @@ -477,7 +547,9 @@ public function getUniqueOpens() /** * Sets uniqueOpens + * * @param int $uniqueOpens Number of unique openings for the timeframe + * * @return $this */ public function setUniqueOpens($uniqueOpens) @@ -489,6 +561,7 @@ public function setUniqueOpens($uniqueOpens) /** * Gets spamReports + * * @return int */ public function getSpamReports() @@ -498,7 +571,9 @@ public function getSpamReports() /** * Sets spamReports + * * @param int $spamReports Number of complaint (spam report) for the timeframe + * * @return $this */ public function setSpamReports($spamReports) @@ -510,6 +585,7 @@ public function setSpamReports($spamReports) /** * Gets blocked + * * @return int */ public function getBlocked() @@ -519,7 +595,9 @@ public function getBlocked() /** * Sets blocked + * * @param int $blocked Number of blocked contact emails for the timeframe + * * @return $this */ public function setBlocked($blocked) @@ -531,6 +609,7 @@ public function setBlocked($blocked) /** * Gets invalid + * * @return int */ public function getInvalid() @@ -540,7 +619,9 @@ public function getInvalid() /** * Sets invalid + * * @param int $invalid Number of invalid emails for the timeframe + * * @return $this */ public function setInvalid($invalid) @@ -551,7 +632,9 @@ public function setInvalid($invalid) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -561,7 +644,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -571,8 +656,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -586,7 +673,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -596,15 +685,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAttributes.php b/lib/Model/GetAttributes.php index 67200261..1cfc8453 100644 --- a/lib/Model/GetAttributes.php +++ b/lib/Model/GetAttributes.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAttributes Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAttributes implements ArrayAccess +class GetAttributes implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAttributes'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetAttributes implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'attributes' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'attributes' => 'attributes' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'attributes' => 'setAttributes' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'attributes' => 'getAttributes' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['attributes'] === null) { - $invalid_properties[] = "'attributes' can't be null"; + $invalidProperties[] = "'attributes' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets attributes + * * @return \SendinBlue\Client\Model\GetAttributesAttributes[] */ public function getAttributes() @@ -177,7 +223,9 @@ public function getAttributes() /** * Sets attributes + * * @param \SendinBlue\Client\Model\GetAttributesAttributes[] $attributes Listing of available contact attributes in your account + * * @return $this */ public function setAttributes($attributes) @@ -188,7 +236,9 @@ public function setAttributes($attributes) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAttributesAttributes.php b/lib/Model/GetAttributesAttributes.php index 5caa2b95..aa334c67 100644 --- a/lib/Model/GetAttributesAttributes.php +++ b/lib/Model/GetAttributesAttributes.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAttributesAttributes Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAttributesAttributes implements ArrayAccess +class GetAttributesAttributes implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAttributes_attributes'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class GetAttributesAttributes implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class GetAttributesAttributes implements ArrayAccess 'calculatedValue' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'calculatedValue' => 'calculatedValue' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'calculatedValue' => 'setCalculatedValue' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,21 +137,47 @@ public static function swaggerFormats() 'calculatedValue' => 'getCalculatedValue' ]; + /** + * 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 CATEGORY_NORMAL = 'normal'; const CATEGORY_TRANSACTIONAL = 'transactional'; const CATEGORY_CATEGORY = 'category'; @@ -150,6 +192,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getCategoryAllowableValues() @@ -165,6 +208,7 @@ public function getCategoryAllowableValues() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -180,13 +224,16 @@ public function getTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -198,41 +245,41 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['category'] === null) { - $invalid_properties[] = "'category' can't be null"; + $invalidProperties[] = "'category' can't be null"; } - $allowed_values = $this->getCategoryAllowableValues(); - if (!in_array($this->container['category'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($this->container['category'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'category', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -246,12 +293,12 @@ public function valid() if ($this->container['category'] === null) { return false; } - $allowed_values = $this->getCategoryAllowableValues(); - if (!in_array($this->container['category'], $allowed_values)) { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($this->container['category'], $allowedValues)) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } return true; @@ -260,6 +307,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -269,7 +317,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the attribute + * * @return $this */ public function setName($name) @@ -281,6 +331,7 @@ public function setName($name) /** * Gets category + * * @return string */ public function getCategory() @@ -290,17 +341,19 @@ public function getCategory() /** * Sets category + * * @param string $category Category of the attribute + * * @return $this */ public function setCategory($category) { - $allowed_values = $this->getCategoryAllowableValues(); - if (!in_array($category, $allowed_values)) { + $allowedValues = $this->getCategoryAllowableValues(); + if (!in_array($category, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'category', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -311,6 +364,7 @@ public function setCategory($category) /** * Gets type + * * @return string */ public function getType() @@ -320,17 +374,19 @@ public function getType() /** * Sets type + * * @param string $type Type of the attribute + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -341,6 +397,7 @@ public function setType($type) /** * Gets enumeration + * * @return \SendinBlue\Client\Model\GetAttributesEnumeration[] */ public function getEnumeration() @@ -350,7 +407,9 @@ public function getEnumeration() /** * Sets enumeration + * * @param \SendinBlue\Client\Model\GetAttributesEnumeration[] $enumeration Parameter only available for \"category\" type attributes. + * * @return $this */ public function setEnumeration($enumeration) @@ -362,6 +421,7 @@ public function setEnumeration($enumeration) /** * Gets calculatedValue + * * @return string */ public function getCalculatedValue() @@ -371,7 +431,9 @@ public function getCalculatedValue() /** * Sets calculatedValue + * * @param string $calculatedValue Calculated value formula + * * @return $this */ public function setCalculatedValue($calculatedValue) @@ -382,7 +444,9 @@ public function setCalculatedValue($calculatedValue) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -392,7 +456,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -402,8 +468,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -417,7 +485,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -427,15 +497,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetAttributesEnumeration.php b/lib/Model/GetAttributesEnumeration.php index be3b12d1..d6bcb40d 100644 --- a/lib/Model/GetAttributesEnumeration.php +++ b/lib/Model/GetAttributesEnumeration.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetAttributesEnumeration Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetAttributesEnumeration implements ArrayAccess +class GetAttributesEnumeration implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getAttributes_enumeration'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetAttributesEnumeration implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetAttributesEnumeration implements ArrayAccess 'label' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'label' => 'label' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'label' => 'setLabel' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'label' => 'getLabel' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['value'] === null) { - $invalid_properties[] = "'value' can't be null"; + $invalidProperties[] = "'value' can't be null"; } if ($this->container['label'] === null) { - $invalid_properties[] = "'label' can't be null"; + $invalidProperties[] = "'label' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets value + * * @return int */ public function getValue() @@ -189,7 +235,9 @@ public function getValue() /** * Sets value + * * @param int $value ID of Value of the \"category\" type attribute + * * @return $this */ public function setValue($value) @@ -201,6 +249,7 @@ public function setValue($value) /** * Gets label + * * @return string */ public function getLabel() @@ -210,7 +259,9 @@ public function getLabel() /** * Sets label + * * @param string $label Label of the \"category\" type attribute + * * @return $this */ public function setLabel($label) @@ -221,7 +272,9 @@ public function setLabel($label) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetCampaignOverview.php b/lib/Model/GetCampaignOverview.php index b55690d9..f080a3ed 100644 --- a/lib/Model/GetCampaignOverview.php +++ b/lib/Model/GetCampaignOverview.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetCampaignOverview Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetCampaignOverview implements ArrayAccess +class GetCampaignOverview implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getCampaignOverview'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -64,6 +67,7 @@ class GetCampaignOverview implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -75,18 +79,30 @@ class GetCampaignOverview implements ArrayAccess 'scheduledAt' => 'date-time' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -98,9 +114,9 @@ public static function swaggerFormats() 'scheduledAt' => 'scheduledAt' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -112,9 +128,9 @@ public static function swaggerFormats() 'scheduledAt' => 'setScheduledAt' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -126,21 +142,47 @@ public static function swaggerFormats() 'scheduledAt' => 'getScheduledAt' ]; + /** + * 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 TYPE_CLASSIC = 'classic'; const TYPE_TRIGGER = 'trigger'; const STATUS_DRAFT = 'draft'; @@ -154,6 +196,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -166,6 +209,7 @@ public function getTypeAllowableValues() /** * Gets allowable values of the enum + * * @return string[] */ public function getStatusAllowableValues() @@ -183,13 +227,16 @@ public function getStatusAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -202,50 +249,50 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['subject'] === null) { - $invalid_properties[] = "'subject' can't be null"; + $invalidProperties[] = "'subject' can't be null"; } if ($this->container['type'] === null) { - $invalid_properties[] = "'type' can't be null"; + $invalidProperties[] = "'type' can't be null"; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['status'] === null) { - $invalid_properties[] = "'status' can't be null"; + $invalidProperties[] = "'status' can't be null"; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -265,15 +312,15 @@ public function valid() if ($this->container['type'] === null) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } if ($this->container['status'] === null) { return false; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { return false; } return true; @@ -282,6 +329,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -291,7 +339,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the campaign + * * @return $this */ public function setId($id) @@ -303,6 +353,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -312,7 +363,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the campaign + * * @return $this */ public function setName($name) @@ -324,6 +377,7 @@ public function setName($name) /** * Gets subject + * * @return string */ public function getSubject() @@ -333,7 +387,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the campaign + * * @return $this */ public function setSubject($subject) @@ -345,6 +401,7 @@ public function setSubject($subject) /** * Gets type + * * @return string */ public function getType() @@ -354,17 +411,19 @@ public function getType() /** * Sets type + * * @param string $type Type of campaign + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -375,6 +434,7 @@ public function setType($type) /** * Gets status + * * @return string */ public function getStatus() @@ -384,17 +444,19 @@ public function getStatus() /** * Sets status + * * @param string $status Status of the campaign + * * @return $this */ public function setStatus($status) { - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($status, $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -405,6 +467,7 @@ public function setStatus($status) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -414,7 +477,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -425,7 +490,9 @@ public function setScheduledAt($scheduledAt) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -435,7 +502,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -445,8 +514,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -460,7 +531,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -470,15 +543,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetCampaignRecipients.php b/lib/Model/GetCampaignRecipients.php index 11ae229a..7197818d 100644 --- a/lib/Model/GetCampaignRecipients.php +++ b/lib/Model/GetCampaignRecipients.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetCampaignRecipients Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetCampaignRecipients implements ArrayAccess +class GetCampaignRecipients implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getCampaignRecipients'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetCampaignRecipients implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetCampaignRecipients implements ArrayAccess 'exclusionLists' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'exclusionLists' => 'exclusionLists' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'exclusionLists' => 'setExclusionLists' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'exclusionLists' => 'getExclusionLists' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['lists'] === null) { - $invalid_properties[] = "'lists' can't be null"; + $invalidProperties[] = "'lists' can't be null"; } if ($this->container['exclusionLists'] === null) { - $invalid_properties[] = "'exclusionLists' can't be null"; + $invalidProperties[] = "'exclusionLists' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets lists + * * @return int[] */ public function getLists() @@ -189,7 +235,9 @@ public function getLists() /** * Sets lists - * @param int[] $lists + * + * @param int[] $lists lists + * * @return $this */ public function setLists($lists) @@ -201,6 +249,7 @@ public function setLists($lists) /** * Gets exclusionLists + * * @return int[] */ public function getExclusionLists() @@ -210,7 +259,9 @@ public function getExclusionLists() /** * Sets exclusionLists - * @param int[] $exclusionLists + * + * @param int[] $exclusionLists exclusionLists + * * @return $this */ public function setExclusionLists($exclusionLists) @@ -221,7 +272,9 @@ public function setExclusionLists($exclusionLists) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetCampaignStats.php b/lib/Model/GetCampaignStats.php index 44451414..91b23dcb 100644 --- a/lib/Model/GetCampaignStats.php +++ b/lib/Model/GetCampaignStats.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetCampaignStats Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetCampaignStats implements ArrayAccess +class GetCampaignStats implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getCampaignStats'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -70,6 +73,7 @@ class GetCampaignStats implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -87,18 +91,30 @@ class GetCampaignStats implements ArrayAccess 'deferred' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -116,9 +132,9 @@ public static function swaggerFormats() 'deferred' => 'deferred' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -136,9 +152,9 @@ public static function swaggerFormats() 'deferred' => 'setDeferred' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -156,34 +172,63 @@ public static function swaggerFormats() 'deferred' => 'getDeferred' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -202,52 +247,49 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['uniqueClicks'] === null) { - $invalid_properties[] = "'uniqueClicks' can't be null"; + $invalidProperties[] = "'uniqueClicks' can't be null"; } if ($this->container['clickers'] === null) { - $invalid_properties[] = "'clickers' can't be null"; + $invalidProperties[] = "'clickers' can't be null"; } if ($this->container['complaints'] === null) { - $invalid_properties[] = "'complaints' can't be null"; + $invalidProperties[] = "'complaints' can't be null"; } if ($this->container['delivered'] === null) { - $invalid_properties[] = "'delivered' can't be null"; + $invalidProperties[] = "'delivered' can't be null"; } if ($this->container['sent'] === null) { - $invalid_properties[] = "'sent' can't be null"; + $invalidProperties[] = "'sent' can't be null"; } if ($this->container['softBounces'] === null) { - $invalid_properties[] = "'softBounces' can't be null"; + $invalidProperties[] = "'softBounces' can't be null"; } if ($this->container['hardBounces'] === null) { - $invalid_properties[] = "'hardBounces' can't be null"; + $invalidProperties[] = "'hardBounces' can't be null"; } if ($this->container['uniqueViews'] === null) { - $invalid_properties[] = "'uniqueViews' can't be null"; + $invalidProperties[] = "'uniqueViews' can't be null"; } if ($this->container['unsubscriptions'] === null) { - $invalid_properties[] = "'unsubscriptions' can't be null"; + $invalidProperties[] = "'unsubscriptions' can't be null"; } if ($this->container['viewed'] === null) { - $invalid_properties[] = "'viewed' can't be null"; + $invalidProperties[] = "'viewed' can't be null"; } - if ($this->container['deferred'] === null) { - $invalid_properties[] = "'deferred' can't be null"; - } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -285,15 +327,13 @@ public function valid() if ($this->container['viewed'] === null) { return false; } - if ($this->container['deferred'] === null) { - return false; - } return true; } /** * Gets listId + * * @return int */ public function getListId() @@ -303,7 +343,9 @@ public function getListId() /** * Sets listId - * @param int $listId List Id of email campaign (only in case of get email campaign(s)) + * + * @param int $listId List Id of email campaign (only in case of get email campaign(s)(not for global stats)) + * * @return $this */ public function setListId($listId) @@ -315,6 +357,7 @@ public function setListId($listId) /** * Gets uniqueClicks + * * @return int */ public function getUniqueClicks() @@ -324,7 +367,9 @@ public function getUniqueClicks() /** * Sets uniqueClicks + * * @param int $uniqueClicks Number of unique clicks for the campaign + * * @return $this */ public function setUniqueClicks($uniqueClicks) @@ -336,6 +381,7 @@ public function setUniqueClicks($uniqueClicks) /** * Gets clickers + * * @return int */ public function getClickers() @@ -345,7 +391,9 @@ public function getClickers() /** * Sets clickers - * @param int $clickers Number of clicks for the campaign + * + * @param int $clickers Number of total clicks for the campaign + * * @return $this */ public function setClickers($clickers) @@ -357,6 +405,7 @@ public function setClickers($clickers) /** * Gets complaints + * * @return int */ public function getComplaints() @@ -366,7 +415,9 @@ public function getComplaints() /** * Sets complaints + * * @param int $complaints Number of complaints (Spam reports) for the campaign + * * @return $this */ public function setComplaints($complaints) @@ -378,6 +429,7 @@ public function setComplaints($complaints) /** * Gets delivered + * * @return int */ public function getDelivered() @@ -387,7 +439,9 @@ public function getDelivered() /** * Sets delivered + * * @param int $delivered Number of delivered emails for the campaign + * * @return $this */ public function setDelivered($delivered) @@ -399,6 +453,7 @@ public function setDelivered($delivered) /** * Gets sent + * * @return int */ public function getSent() @@ -408,7 +463,9 @@ public function getSent() /** * Sets sent + * * @param int $sent Number of sent emails for the campaign + * * @return $this */ public function setSent($sent) @@ -420,6 +477,7 @@ public function setSent($sent) /** * Gets softBounces + * * @return int */ public function getSoftBounces() @@ -429,7 +487,9 @@ public function getSoftBounces() /** * Sets softBounces + * * @param int $softBounces Number of softbounce for the campaign + * * @return $this */ public function setSoftBounces($softBounces) @@ -441,6 +501,7 @@ public function setSoftBounces($softBounces) /** * Gets hardBounces + * * @return int */ public function getHardBounces() @@ -450,7 +511,9 @@ public function getHardBounces() /** * Sets hardBounces + * * @param int $hardBounces Number of harbounce for the campaign + * * @return $this */ public function setHardBounces($hardBounces) @@ -462,6 +525,7 @@ public function setHardBounces($hardBounces) /** * Gets uniqueViews + * * @return int */ public function getUniqueViews() @@ -471,7 +535,9 @@ public function getUniqueViews() /** * Sets uniqueViews + * * @param int $uniqueViews Number of unique openings for the campaign + * * @return $this */ public function setUniqueViews($uniqueViews) @@ -483,6 +549,7 @@ public function setUniqueViews($uniqueViews) /** * Gets unsubscriptions + * * @return int */ public function getUnsubscriptions() @@ -492,7 +559,9 @@ public function getUnsubscriptions() /** * Sets unsubscriptions + * * @param int $unsubscriptions Number of unsubscription for the campaign + * * @return $this */ public function setUnsubscriptions($unsubscriptions) @@ -504,6 +573,7 @@ public function setUnsubscriptions($unsubscriptions) /** * Gets viewed + * * @return int */ public function getViewed() @@ -513,7 +583,9 @@ public function getViewed() /** * Sets viewed + * * @param int $viewed Number of openings for the campaign + * * @return $this */ public function setViewed($viewed) @@ -525,6 +597,7 @@ public function setViewed($viewed) /** * Gets deferred + * * @return int */ public function getDeferred() @@ -534,7 +607,9 @@ public function getDeferred() /** * Sets deferred + * * @param int $deferred Number of deferred emails for the campaign + * * @return $this */ public function setDeferred($deferred) @@ -545,7 +620,9 @@ public function setDeferred($deferred) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -555,7 +632,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -565,8 +644,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -580,7 +661,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -590,15 +673,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetChildInfo.php b/lib/Model/GetChildInfo.php index a67778d2..6991820a 100644 --- a/lib/Model/GetChildInfo.php +++ b/lib/Model/GetChildInfo.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetChildInfo Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetChildInfo implements ArrayAccess +class GetChildInfo implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getChildInfo'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -67,6 +70,7 @@ class GetChildInfo implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -81,18 +85,30 @@ class GetChildInfo implements ArrayAccess 'apiKeys' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -107,9 +123,9 @@ public static function swaggerFormats() 'apiKeys' => 'apiKeys' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -124,9 +140,9 @@ public static function swaggerFormats() 'apiKeys' => 'setApiKeys' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -141,34 +157,63 @@ public static function swaggerFormats() 'apiKeys' => 'getApiKeys' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -184,34 +229,34 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['firstName'] === null) { - $invalid_properties[] = "'firstName' can't be null"; + $invalidProperties[] = "'firstName' can't be null"; } if ($this->container['lastName'] === null) { - $invalid_properties[] = "'lastName' can't be null"; + $invalidProperties[] = "'lastName' can't be null"; } if ($this->container['companyName'] === null) { - $invalid_properties[] = "'companyName' can't be null"; + $invalidProperties[] = "'companyName' can't be null"; } if ($this->container['password'] === null) { - $invalid_properties[] = "'password' can't be null"; + $invalidProperties[] = "'password' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -240,6 +285,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -249,7 +295,9 @@ public function getEmail() /** * Sets email + * * @param string $email Login Email + * * @return $this */ public function setEmail($email) @@ -261,6 +309,7 @@ public function setEmail($email) /** * Gets firstName + * * @return string */ public function getFirstName() @@ -270,7 +319,9 @@ public function getFirstName() /** * Sets firstName + * * @param string $firstName First Name + * * @return $this */ public function setFirstName($firstName) @@ -282,6 +333,7 @@ public function setFirstName($firstName) /** * Gets lastName + * * @return string */ public function getLastName() @@ -291,7 +343,9 @@ public function getLastName() /** * Sets lastName + * * @param string $lastName Last Name + * * @return $this */ public function setLastName($lastName) @@ -303,6 +357,7 @@ public function setLastName($lastName) /** * Gets companyName + * * @return string */ public function getCompanyName() @@ -312,7 +367,9 @@ public function getCompanyName() /** * Sets companyName + * * @param string $companyName Name of the company + * * @return $this */ public function setCompanyName($companyName) @@ -324,6 +381,7 @@ public function setCompanyName($companyName) /** * Gets credits + * * @return \SendinBlue\Client\Model\GetChildInfoCredits */ public function getCredits() @@ -333,7 +391,9 @@ public function getCredits() /** * Sets credits - * @param \SendinBlue\Client\Model\GetChildInfoCredits $credits + * + * @param \SendinBlue\Client\Model\GetChildInfoCredits $credits credits + * * @return $this */ public function setCredits($credits) @@ -345,6 +405,7 @@ public function setCredits($credits) /** * Gets statistics + * * @return \SendinBlue\Client\Model\GetChildInfoStatistics */ public function getStatistics() @@ -354,7 +415,9 @@ public function getStatistics() /** * Sets statistics - * @param \SendinBlue\Client\Model\GetChildInfoStatistics $statistics + * + * @param \SendinBlue\Client\Model\GetChildInfoStatistics $statistics statistics + * * @return $this */ public function setStatistics($statistics) @@ -366,6 +429,7 @@ public function setStatistics($statistics) /** * Gets password + * * @return string */ public function getPassword() @@ -375,7 +439,9 @@ public function getPassword() /** * Sets password + * * @param string $password The encrypted password of child account + * * @return $this */ public function setPassword($password) @@ -387,6 +453,7 @@ public function setPassword($password) /** * Gets ips + * * @return string[] */ public function getIps() @@ -396,7 +463,9 @@ public function getIps() /** * Sets ips + * * @param string[] $ips IP(s) associated to a child account user + * * @return $this */ public function setIps($ips) @@ -408,6 +477,7 @@ public function setIps($ips) /** * Gets apiKeys + * * @return \SendinBlue\Client\Model\GetChildInfoApiKeys */ public function getApiKeys() @@ -417,7 +487,9 @@ public function getApiKeys() /** * Sets apiKeys - * @param \SendinBlue\Client\Model\GetChildInfoApiKeys $apiKeys + * + * @param \SendinBlue\Client\Model\GetChildInfoApiKeys $apiKeys apiKeys + * * @return $this */ public function setApiKeys($apiKeys) @@ -428,7 +500,9 @@ public function setApiKeys($apiKeys) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -438,7 +512,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -448,8 +524,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -463,7 +541,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -473,15 +553,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetChildInfoApiKeys.php b/lib/Model/GetChildInfoApiKeys.php index a2fa1282..cf42ddeb 100644 --- a/lib/Model/GetChildInfoApiKeys.php +++ b/lib/Model/GetChildInfoApiKeys.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetChildInfoApiKeys Class Doc Comment * - * @category Class + * @category Class * @description API Keys associated to child account - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetChildInfoApiKeys implements ArrayAccess +class GetChildInfoApiKeys implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getChildInfo_apiKeys'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class GetChildInfoApiKeys implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -68,18 +72,30 @@ class GetChildInfoApiKeys implements ArrayAccess 'v3' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -87,9 +103,9 @@ public static function swaggerFormats() 'v3' => 'v3' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -97,9 +113,9 @@ public static function swaggerFormats() 'v3' => 'setV3' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -107,34 +123,63 @@ public static function swaggerFormats() 'v3' => 'getV3' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -143,22 +188,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['v2'] === null) { - $invalid_properties[] = "'v2' can't be null"; + $invalidProperties[] = "'v2' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -175,6 +220,7 @@ public function valid() /** * Gets v2 + * * @return \SendinBlue\Client\Model\GetChildInfoApiKeysV2[] */ public function getV2() @@ -184,7 +230,9 @@ public function getV2() /** * Sets v2 - * @param \SendinBlue\Client\Model\GetChildInfoApiKeysV2[] $v2 + * + * @param \SendinBlue\Client\Model\GetChildInfoApiKeysV2[] $v2 v2 + * * @return $this */ public function setV2($v2) @@ -196,6 +244,7 @@ public function setV2($v2) /** * Gets v3 + * * @return \SendinBlue\Client\Model\GetChildInfoApiKeysV3[] */ public function getV3() @@ -205,7 +254,9 @@ public function getV3() /** * Sets v3 - * @param \SendinBlue\Client\Model\GetChildInfoApiKeysV3[] $v3 + * + * @param \SendinBlue\Client\Model\GetChildInfoApiKeysV3[] $v3 v3 + * * @return $this */ public function setV3($v3) @@ -216,7 +267,9 @@ public function setV3($v3) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -226,7 +279,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -236,8 +291,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -251,7 +308,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -261,15 +320,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetChildInfoApiKeysV2.php b/lib/Model/GetChildInfoApiKeysV2.php index 842f61cf..f4d2369e 100644 --- a/lib/Model/GetChildInfoApiKeysV2.php +++ b/lib/Model/GetChildInfoApiKeysV2.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetChildInfoApiKeysV2 Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetChildInfoApiKeysV2 implements ArrayAccess +class GetChildInfoApiKeysV2 implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getChildInfo_apiKeys_v2'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetChildInfoApiKeysV2 implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetChildInfoApiKeysV2 implements ArrayAccess 'key' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'key' => 'key' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'key' => 'setKey' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'key' => 'getKey' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['key'] === null) { - $invalid_properties[] = "'key' can't be null"; + $invalidProperties[] = "'key' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -189,7 +235,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the key for version 2 + * * @return $this */ public function setName($name) @@ -201,6 +249,7 @@ public function setName($name) /** * Gets key + * * @return string */ public function getKey() @@ -210,7 +259,9 @@ public function getKey() /** * Sets key + * * @param string $key API Key for version 2 + * * @return $this */ public function setKey($key) @@ -221,7 +272,9 @@ public function setKey($key) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetChildInfoApiKeysV3.php b/lib/Model/GetChildInfoApiKeysV3.php index e97f9278..b9d7c9da 100644 --- a/lib/Model/GetChildInfoApiKeysV3.php +++ b/lib/Model/GetChildInfoApiKeysV3.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetChildInfoApiKeysV3 Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetChildInfoApiKeysV3 implements ArrayAccess +class GetChildInfoApiKeysV3 implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getChildInfo_apiKeys_v3'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetChildInfoApiKeysV3 implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetChildInfoApiKeysV3 implements ArrayAccess 'key' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'key' => 'key' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'key' => 'setKey' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'key' => 'getKey' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['key'] === null) { - $invalid_properties[] = "'key' can't be null"; + $invalidProperties[] = "'key' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -189,7 +235,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the key for version 3 + * * @return $this */ public function setName($name) @@ -201,6 +249,7 @@ public function setName($name) /** * Gets key + * * @return string */ public function getKey() @@ -210,7 +259,9 @@ public function getKey() /** * Sets key + * * @param string $key API Key for version 3 + * * @return $this */ public function setKey($key) @@ -221,7 +272,9 @@ public function setKey($key) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetChildInfoCredits.php b/lib/Model/GetChildInfoCredits.php index efcdb91d..3c043c05 100644 --- a/lib/Model/GetChildInfoCredits.php +++ b/lib/Model/GetChildInfoCredits.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetChildInfoCredits Class Doc Comment * - * @category Class + * @category Class * @description Credits available for your child - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetChildInfoCredits implements ArrayAccess +class GetChildInfoCredits implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getChildInfo_credits'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class GetChildInfoCredits implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -68,18 +72,30 @@ class GetChildInfoCredits implements ArrayAccess 'smsCredits' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -87,9 +103,9 @@ public static function swaggerFormats() 'smsCredits' => 'smsCredits' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -97,9 +113,9 @@ public static function swaggerFormats() 'smsCredits' => 'setSmsCredits' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -107,34 +123,63 @@ public static function swaggerFormats() 'smsCredits' => 'getSmsCredits' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -143,19 +188,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -169,6 +214,7 @@ public function valid() /** * Gets emailCredits + * * @return int */ public function getEmailCredits() @@ -178,7 +224,9 @@ public function getEmailCredits() /** * Sets emailCredits + * * @param int $emailCredits Email credits available for your child + * * @return $this */ public function setEmailCredits($emailCredits) @@ -190,6 +238,7 @@ public function setEmailCredits($emailCredits) /** * Gets smsCredits + * * @return int */ public function getSmsCredits() @@ -199,7 +248,9 @@ public function getSmsCredits() /** * Sets smsCredits + * * @param int $smsCredits SMS credits available for your child + * * @return $this */ public function setSmsCredits($smsCredits) @@ -210,7 +261,9 @@ public function setSmsCredits($smsCredits) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -220,7 +273,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -230,8 +285,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -245,7 +302,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -255,15 +314,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetChildInfoStatistics.php b/lib/Model/GetChildInfoStatistics.php index 2c4a5637..0b5dafe6 100644 --- a/lib/Model/GetChildInfoStatistics.php +++ b/lib/Model/GetChildInfoStatistics.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetChildInfoStatistics Class Doc Comment * - * @category Class + * @category Class * @description Statistics about your child account activity - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetChildInfoStatistics implements ArrayAccess +class GetChildInfoStatistics implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getChildInfo_statistics'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetChildInfoStatistics implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -70,18 +74,30 @@ class GetChildInfoStatistics implements ArrayAccess 'totalSent' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -90,9 +106,9 @@ public static function swaggerFormats() 'totalSent' => 'totalSent' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -101,9 +117,9 @@ public static function swaggerFormats() 'totalSent' => 'setTotalSent' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -112,34 +128,63 @@ public static function swaggerFormats() 'totalSent' => 'getTotalSent' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -149,19 +194,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -175,6 +220,7 @@ public function valid() /** * Gets previousMonthTotalSent + * * @return int */ public function getPreviousMonthTotalSent() @@ -184,7 +230,9 @@ public function getPreviousMonthTotalSent() /** * Sets previousMonthTotalSent + * * @param int $previousMonthTotalSent Overall emails sent for the previous month + * * @return $this */ public function setPreviousMonthTotalSent($previousMonthTotalSent) @@ -196,6 +244,7 @@ public function setPreviousMonthTotalSent($previousMonthTotalSent) /** * Gets currentMonthTotalSent + * * @return int */ public function getCurrentMonthTotalSent() @@ -205,7 +254,9 @@ public function getCurrentMonthTotalSent() /** * Sets currentMonthTotalSent + * * @param int $currentMonthTotalSent Overall emails sent for current month + * * @return $this */ public function setCurrentMonthTotalSent($currentMonthTotalSent) @@ -217,6 +268,7 @@ public function setCurrentMonthTotalSent($currentMonthTotalSent) /** * Gets totalSent + * * @return int */ public function getTotalSent() @@ -226,7 +278,9 @@ public function getTotalSent() /** * Sets totalSent + * * @param int $totalSent Overall emails sent for since the account exists + * * @return $this */ public function setTotalSent($totalSent) @@ -237,7 +291,9 @@ public function setTotalSent($totalSent) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -247,7 +303,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -257,8 +315,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -272,7 +332,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -282,15 +344,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetChildrenList.php b/lib/Model/GetChildrenList.php index 56a49893..7a2fed21 100644 --- a/lib/Model/GetChildrenList.php +++ b/lib/Model/GetChildrenList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetChildrenList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetChildrenList implements ArrayAccess +class GetChildrenList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getChildrenList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetChildrenList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'children' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'children' => 'children' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'children' => 'setChildren' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'children' => 'getChildren' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets children + * * @return object[] */ public function getChildren() @@ -171,7 +217,9 @@ public function getChildren() /** * Sets children + * * @param object[] $children Your children's account information + * * @return $this */ public function setChildren($children) @@ -182,7 +230,9 @@ public function setChildren($children) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetClient.php b/lib/Model/GetClient.php index 1bcbf91e..a908c1a6 100644 --- a/lib/Model/GetClient.php +++ b/lib/Model/GetClient.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetClient Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetClient implements ArrayAccess +class GetClient implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getClient'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetClient implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class GetClient implements ArrayAccess 'companyName' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'companyName' => 'companyName' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'companyName' => 'setCompanyName' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,34 +132,63 @@ public static function swaggerFormats() 'companyName' => 'getCompanyName' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -154,31 +199,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['firstName'] === null) { - $invalid_properties[] = "'firstName' can't be null"; + $invalidProperties[] = "'firstName' can't be null"; } if ($this->container['lastName'] === null) { - $invalid_properties[] = "'lastName' can't be null"; + $invalidProperties[] = "'lastName' can't be null"; } if ($this->container['companyName'] === null) { - $invalid_properties[] = "'companyName' can't be null"; + $invalidProperties[] = "'companyName' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -204,6 +249,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -213,7 +259,9 @@ public function getEmail() /** * Sets email + * * @param string $email Login Email + * * @return $this */ public function setEmail($email) @@ -225,6 +273,7 @@ public function setEmail($email) /** * Gets firstName + * * @return string */ public function getFirstName() @@ -234,7 +283,9 @@ public function getFirstName() /** * Sets firstName + * * @param string $firstName First Name + * * @return $this */ public function setFirstName($firstName) @@ -246,6 +297,7 @@ public function setFirstName($firstName) /** * Gets lastName + * * @return string */ public function getLastName() @@ -255,7 +307,9 @@ public function getLastName() /** * Sets lastName + * * @param string $lastName Last Name + * * @return $this */ public function setLastName($lastName) @@ -267,6 +321,7 @@ public function setLastName($lastName) /** * Gets companyName + * * @return string */ public function getCompanyName() @@ -276,7 +331,9 @@ public function getCompanyName() /** * Sets companyName + * * @param string $companyName Name of the company + * * @return $this */ public function setCompanyName($companyName) @@ -287,7 +344,9 @@ public function setCompanyName($companyName) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -297,7 +356,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -307,8 +368,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -322,7 +385,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -332,15 +397,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetContactCampaignStats.php b/lib/Model/GetContactCampaignStats.php index 647b7779..e917e7e7 100644 --- a/lib/Model/GetContactCampaignStats.php +++ b/lib/Model/GetContactCampaignStats.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetContactCampaignStats Class Doc Comment * - * @category Class + * @category Class * @description Campaign Statistics for the contact - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetContactCampaignStats implements ArrayAccess +class GetContactCampaignStats implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getContactCampaignStats'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -67,6 +70,7 @@ class GetContactCampaignStats implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -80,18 +84,30 @@ class GetContactCampaignStats implements ArrayAccess 'transacAttributes' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -105,9 +121,9 @@ public static function swaggerFormats() 'transacAttributes' => 'transacAttributes' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -121,9 +137,9 @@ public static function swaggerFormats() 'transacAttributes' => 'setTransacAttributes' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -137,34 +153,63 @@ public static function swaggerFormats() 'transacAttributes' => 'getTransacAttributes' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -179,19 +224,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -205,6 +250,7 @@ public function valid() /** * Gets messagesSent + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getMessagesSent() @@ -214,7 +260,9 @@ public function getMessagesSent() /** * Sets messagesSent - * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent + * + * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent messagesSent + * * @return $this */ public function setMessagesSent($messagesSent) @@ -226,6 +274,7 @@ public function setMessagesSent($messagesSent) /** * Gets hardBounces + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getHardBounces() @@ -235,7 +284,9 @@ public function getHardBounces() /** * Sets hardBounces - * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces + * + * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces hardBounces + * * @return $this */ public function setHardBounces($hardBounces) @@ -247,6 +298,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getSoftBounces() @@ -256,7 +308,9 @@ public function getSoftBounces() /** * Sets softBounces - * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces + * + * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces softBounces + * * @return $this */ public function setSoftBounces($softBounces) @@ -268,6 +322,7 @@ public function setSoftBounces($softBounces) /** * Gets complaints + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getComplaints() @@ -277,7 +332,9 @@ public function getComplaints() /** * Sets complaints - * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints + * + * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints complaints + * * @return $this */ public function setComplaints($complaints) @@ -289,6 +346,7 @@ public function setComplaints($complaints) /** * Gets unsubscriptions + * * @return \SendinBlue\Client\Model\GetContactCampaignStatsUnsubscriptions */ public function getUnsubscriptions() @@ -298,7 +356,9 @@ public function getUnsubscriptions() /** * Sets unsubscriptions - * @param \SendinBlue\Client\Model\GetContactCampaignStatsUnsubscriptions $unsubscriptions + * + * @param \SendinBlue\Client\Model\GetContactCampaignStatsUnsubscriptions $unsubscriptions unsubscriptions + * * @return $this */ public function setUnsubscriptions($unsubscriptions) @@ -310,6 +370,7 @@ public function setUnsubscriptions($unsubscriptions) /** * Gets opened + * * @return \SendinBlue\Client\Model\GetContactCampaignStatsOpened[] */ public function getOpened() @@ -319,7 +380,9 @@ public function getOpened() /** * Sets opened - * @param \SendinBlue\Client\Model\GetContactCampaignStatsOpened[] $opened + * + * @param \SendinBlue\Client\Model\GetContactCampaignStatsOpened[] $opened opened + * * @return $this */ public function setOpened($opened) @@ -331,6 +394,7 @@ public function setOpened($opened) /** * Gets clicked + * * @return \SendinBlue\Client\Model\GetContactCampaignStatsClicked[] */ public function getClicked() @@ -340,7 +404,9 @@ public function getClicked() /** * Sets clicked - * @param \SendinBlue\Client\Model\GetContactCampaignStatsClicked[] $clicked + * + * @param \SendinBlue\Client\Model\GetContactCampaignStatsClicked[] $clicked clicked + * * @return $this */ public function setClicked($clicked) @@ -352,6 +418,7 @@ public function setClicked($clicked) /** * Gets transacAttributes + * * @return \SendinBlue\Client\Model\GetContactCampaignStatsTransacAttributes[] */ public function getTransacAttributes() @@ -361,7 +428,9 @@ public function getTransacAttributes() /** * Sets transacAttributes - * @param \SendinBlue\Client\Model\GetContactCampaignStatsTransacAttributes[] $transacAttributes + * + * @param \SendinBlue\Client\Model\GetContactCampaignStatsTransacAttributes[] $transacAttributes transacAttributes + * * @return $this */ public function setTransacAttributes($transacAttributes) @@ -372,7 +441,9 @@ public function setTransacAttributes($transacAttributes) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -382,7 +453,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -392,8 +465,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -407,7 +482,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -417,15 +494,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetContactCampaignStatsClicked.php b/lib/Model/GetContactCampaignStatsClicked.php index 7f2d6778..296e2a99 100644 --- a/lib/Model/GetContactCampaignStatsClicked.php +++ b/lib/Model/GetContactCampaignStatsClicked.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetContactCampaignStatsClicked Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetContactCampaignStatsClicked implements ArrayAccess +class GetContactCampaignStatsClicked implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getContactCampaignStats_clicked'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetContactCampaignStatsClicked implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetContactCampaignStatsClicked implements ArrayAccess 'links' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'links' => 'links' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'links' => 'setLinks' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'links' => 'getLinks' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['campaignId'] === null) { - $invalid_properties[] = "'campaignId' can't be null"; + $invalidProperties[] = "'campaignId' can't be null"; } if ($this->container['links'] === null) { - $invalid_properties[] = "'links' can't be null"; + $invalidProperties[] = "'links' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets campaignId + * * @return int */ public function getCampaignId() @@ -189,7 +235,9 @@ public function getCampaignId() /** * Sets campaignId + * * @param int $campaignId ID of the campaign which generated the event + * * @return $this */ public function setCampaignId($campaignId) @@ -201,6 +249,7 @@ public function setCampaignId($campaignId) /** * Gets links + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsLinks[] */ public function getLinks() @@ -210,7 +259,9 @@ public function getLinks() /** * Sets links - * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsLinks[] $links + * + * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsLinks[] $links links + * * @return $this */ public function setLinks($links) @@ -221,7 +272,9 @@ public function setLinks($links) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetContactCampaignStatsOpened.php b/lib/Model/GetContactCampaignStatsOpened.php index a992090b..53cd6540 100644 --- a/lib/Model/GetContactCampaignStatsOpened.php +++ b/lib/Model/GetContactCampaignStatsOpened.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetContactCampaignStatsOpened Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetContactCampaignStatsOpened implements ArrayAccess +class GetContactCampaignStatsOpened implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getContactCampaignStats_opened'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetContactCampaignStatsOpened implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class GetContactCampaignStatsOpened implements ArrayAccess 'ip' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'ip' => 'ip' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'ip' => 'setIp' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,34 +132,63 @@ public static function swaggerFormats() 'ip' => 'getIp' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -154,31 +199,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['campaignId'] === null) { - $invalid_properties[] = "'campaignId' can't be null"; + $invalidProperties[] = "'campaignId' can't be null"; } if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } if ($this->container['eventTime'] === null) { - $invalid_properties[] = "'eventTime' can't be null"; + $invalidProperties[] = "'eventTime' can't be null"; } if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -204,6 +249,7 @@ public function valid() /** * Gets campaignId + * * @return int */ public function getCampaignId() @@ -213,7 +259,9 @@ public function getCampaignId() /** * Sets campaignId + * * @param int $campaignId ID of the campaign which generated the event + * * @return $this */ public function setCampaignId($campaignId) @@ -225,6 +273,7 @@ public function setCampaignId($campaignId) /** * Gets count + * * @return int */ public function getCount() @@ -234,7 +283,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of openings of the campaign + * * @return $this */ public function setCount($count) @@ -246,6 +297,7 @@ public function setCount($count) /** * Gets eventTime + * * @return \DateTime */ public function getEventTime() @@ -255,7 +307,9 @@ public function getEventTime() /** * Sets eventTime + * * @param \DateTime $eventTime UTC date-time of the event + * * @return $this */ public function setEventTime($eventTime) @@ -267,6 +321,7 @@ public function setEventTime($eventTime) /** * Gets ip + * * @return string */ public function getIp() @@ -276,7 +331,9 @@ public function getIp() /** * Sets ip + * * @param string $ip IP from which the user has opened the campaign + * * @return $this */ public function setIp($ip) @@ -287,7 +344,9 @@ public function setIp($ip) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -297,7 +356,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -307,8 +368,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -322,7 +385,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -332,15 +397,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetContactCampaignStatsTransacAttributes.php b/lib/Model/GetContactCampaignStatsTransacAttributes.php index 2a2e7599..9d8d7368 100644 --- a/lib/Model/GetContactCampaignStatsTransacAttributes.php +++ b/lib/Model/GetContactCampaignStatsTransacAttributes.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetContactCampaignStatsTransacAttributes Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetContactCampaignStatsTransacAttributes implements ArrayAccess +class GetContactCampaignStatsTransacAttributes implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getContactCampaignStats_transacAttributes'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class GetContactCampaignStatsTransacAttributes implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class GetContactCampaignStatsTransacAttributes implements ArrayAccess 'orderId' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'orderId' => 'orderId' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'orderId' => 'setOrderId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'orderId' => 'getOrderId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,28 +193,28 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['orderDate'] === null) { - $invalid_properties[] = "'orderDate' can't be null"; + $invalidProperties[] = "'orderDate' can't be null"; } if ($this->container['orderPrice'] === null) { - $invalid_properties[] = "'orderPrice' can't be null"; + $invalidProperties[] = "'orderPrice' can't be null"; } if ($this->container['orderId'] === null) { - $invalid_properties[] = "'orderId' can't be null"; + $invalidProperties[] = "'orderId' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -192,6 +237,7 @@ public function valid() /** * Gets orderDate + * * @return \DateTime */ public function getOrderDate() @@ -201,7 +247,9 @@ public function getOrderDate() /** * Sets orderDate + * * @param \DateTime $orderDate Date of the order + * * @return $this */ public function setOrderDate($orderDate) @@ -213,6 +261,7 @@ public function setOrderDate($orderDate) /** * Gets orderPrice + * * @return float */ public function getOrderPrice() @@ -222,7 +271,9 @@ public function getOrderPrice() /** * Sets orderPrice + * * @param float $orderPrice Price of the order + * * @return $this */ public function setOrderPrice($orderPrice) @@ -234,6 +285,7 @@ public function setOrderPrice($orderPrice) /** * Gets orderId + * * @return int */ public function getOrderId() @@ -243,7 +295,9 @@ public function getOrderId() /** * Sets orderId + * * @param int $orderId ID of the order + * * @return $this */ public function setOrderId($orderId) @@ -254,7 +308,9 @@ public function setOrderId($orderId) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -264,7 +320,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -274,8 +332,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -289,7 +349,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -299,15 +361,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetContactCampaignStatsUnsubscriptions.php b/lib/Model/GetContactCampaignStatsUnsubscriptions.php index 8e1eb5d7..87aef870 100644 --- a/lib/Model/GetContactCampaignStatsUnsubscriptions.php +++ b/lib/Model/GetContactCampaignStatsUnsubscriptions.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetContactCampaignStatsUnsubscriptions Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetContactCampaignStatsUnsubscriptions implements ArrayAccess +class GetContactCampaignStatsUnsubscriptions implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getContactCampaignStats_unsubscriptions'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetContactCampaignStatsUnsubscriptions implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetContactCampaignStatsUnsubscriptions implements ArrayAccess 'adminUnsubscription' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'adminUnsubscription' => 'adminUnsubscription' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'adminUnsubscription' => 'setAdminUnsubscription' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'adminUnsubscription' => 'getAdminUnsubscription' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['userUnsubscription'] === null) { - $invalid_properties[] = "'userUnsubscription' can't be null"; + $invalidProperties[] = "'userUnsubscription' can't be null"; } if ($this->container['adminUnsubscription'] === null) { - $invalid_properties[] = "'adminUnsubscription' can't be null"; + $invalidProperties[] = "'adminUnsubscription' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets userUnsubscription + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] */ public function getUserUnsubscription() @@ -189,7 +235,9 @@ public function getUserUnsubscription() /** * Sets userUnsubscription + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact has unsubscribed via the unsubscription link in the email + * * @return $this */ public function setUserUnsubscription($userUnsubscription) @@ -201,6 +249,7 @@ public function setUserUnsubscription($userUnsubscription) /** * Gets adminUnsubscription + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] */ public function getAdminUnsubscription() @@ -210,7 +259,9 @@ public function getAdminUnsubscription() /** * Sets adminUnsubscription + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator + * * @return $this */ public function setAdminUnsubscription($adminUnsubscription) @@ -221,7 +272,9 @@ public function setAdminUnsubscription($adminUnsubscription) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetContactDetails.php b/lib/Model/GetContactDetails.php index 958cb169..a8c3acf5 100644 --- a/lib/Model/GetContactDetails.php +++ b/lib/Model/GetContactDetails.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetContactDetails Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetContactDetails implements ArrayAccess +class GetContactDetails implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getContactDetails'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,11 +64,12 @@ class GetContactDetails implements ArrayAccess 'modifiedAt' => '\DateTime', 'listIds' => 'int[]', 'listUnsubscribed' => 'int[]', - 'attributes' => 'map[string,string]' + 'attributes' => 'object' ]; /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -79,18 +83,30 @@ class GetContactDetails implements ArrayAccess 'attributes' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'attributes' => 'attributes' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -120,9 +136,9 @@ public static function swaggerFormats() 'attributes' => 'setAttributes' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -136,34 +152,63 @@ public static function swaggerFormats() 'attributes' => 'getAttributes' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -178,40 +223,40 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['emailBlacklisted'] === null) { - $invalid_properties[] = "'emailBlacklisted' can't be null"; + $invalidProperties[] = "'emailBlacklisted' can't be null"; } if ($this->container['smsBlacklisted'] === null) { - $invalid_properties[] = "'smsBlacklisted' can't be null"; + $invalidProperties[] = "'smsBlacklisted' can't be null"; } if ($this->container['modifiedAt'] === null) { - $invalid_properties[] = "'modifiedAt' can't be null"; + $invalidProperties[] = "'modifiedAt' can't be null"; } if ($this->container['listIds'] === null) { - $invalid_properties[] = "'listIds' can't be null"; + $invalidProperties[] = "'listIds' can't be null"; } if ($this->container['attributes'] === null) { - $invalid_properties[] = "'attributes' can't be null"; + $invalidProperties[] = "'attributes' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -246,6 +291,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -255,7 +301,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email address of the contact for which you requested the details + * * @return $this */ public function setEmail($email) @@ -267,6 +315,7 @@ public function setEmail($email) /** * Gets id + * * @return int */ public function getId() @@ -276,7 +325,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the contact for which you requested the details + * * @return $this */ public function setId($id) @@ -288,6 +339,7 @@ public function setId($id) /** * Gets emailBlacklisted + * * @return bool */ public function getEmailBlacklisted() @@ -297,7 +349,9 @@ public function getEmailBlacklisted() /** * Sets emailBlacklisted + * * @param bool $emailBlacklisted Blacklist status for email campaigns (true=blacklisted, false=not blacklisted) + * * @return $this */ public function setEmailBlacklisted($emailBlacklisted) @@ -309,6 +363,7 @@ public function setEmailBlacklisted($emailBlacklisted) /** * Gets smsBlacklisted + * * @return bool */ public function getSmsBlacklisted() @@ -318,7 +373,9 @@ public function getSmsBlacklisted() /** * Sets smsBlacklisted + * * @param bool $smsBlacklisted Blacklist status for SMS campaigns (true=blacklisted, false=not blacklisted) + * * @return $this */ public function setSmsBlacklisted($smsBlacklisted) @@ -330,6 +387,7 @@ public function setSmsBlacklisted($smsBlacklisted) /** * Gets modifiedAt + * * @return \DateTime */ public function getModifiedAt() @@ -339,7 +397,9 @@ public function getModifiedAt() /** * Sets modifiedAt + * * @param \DateTime $modifiedAt Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setModifiedAt($modifiedAt) @@ -351,6 +411,7 @@ public function setModifiedAt($modifiedAt) /** * Gets listIds + * * @return int[] */ public function getListIds() @@ -360,7 +421,9 @@ public function getListIds() /** * Sets listIds - * @param int[] $listIds + * + * @param int[] $listIds listIds + * * @return $this */ public function setListIds($listIds) @@ -372,6 +435,7 @@ public function setListIds($listIds) /** * Gets listUnsubscribed + * * @return int[] */ public function getListUnsubscribed() @@ -381,7 +445,9 @@ public function getListUnsubscribed() /** * Sets listUnsubscribed - * @param int[] $listUnsubscribed + * + * @param int[] $listUnsubscribed listUnsubscribed + * * @return $this */ public function setListUnsubscribed($listUnsubscribed) @@ -393,7 +459,8 @@ public function setListUnsubscribed($listUnsubscribed) /** * Gets attributes - * @return map[string,string] + * + * @return object */ public function getAttributes() { @@ -402,7 +469,9 @@ public function getAttributes() /** * Sets attributes - * @param map[string,string] $attributes + * + * @param object $attributes Set of attributes of the contact + * * @return $this */ public function setAttributes($attributes) @@ -413,7 +482,9 @@ public function setAttributes($attributes) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -423,7 +494,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -433,8 +506,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -448,7 +523,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -458,15 +535,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetContacts.php b/lib/Model/GetContacts.php index 2d3fadac..3c6c4e99 100644 --- a/lib/Model/GetContacts.php +++ b/lib/Model/GetContacts.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetContacts Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetContacts implements ArrayAccess +class GetContacts implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getContacts'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetContacts implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetContacts implements ArrayAccess 'count' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'count' => 'count' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'count' => 'setCount' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'count' => 'getCount' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['contacts'] === null) { - $invalid_properties[] = "'contacts' can't be null"; + $invalidProperties[] = "'contacts' can't be null"; } if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets contacts + * * @return object[] */ public function getContacts() @@ -189,7 +235,9 @@ public function getContacts() /** * Sets contacts - * @param object[] $contacts + * + * @param object[] $contacts contacts + * * @return $this */ public function setContacts($contacts) @@ -201,6 +249,7 @@ public function setContacts($contacts) /** * Gets count + * * @return int */ public function getCount() @@ -210,7 +259,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of contacts + * * @return $this */ public function setCount($count) @@ -221,7 +272,9 @@ public function setCount($count) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetEmailCampaign.php b/lib/Model/GetEmailCampaign.php index 53386206..9baa7e14 100644 --- a/lib/Model/GetEmailCampaign.php +++ b/lib/Model/GetEmailCampaign.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetEmailCampaign Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetEmailCampaign implements ArrayAccess +class GetEmailCampaign implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getEmailCampaign'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -80,6 +83,7 @@ class GetEmailCampaign implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -107,18 +111,30 @@ class GetEmailCampaign implements ArrayAccess 'statistics' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -146,9 +162,9 @@ public static function swaggerFormats() 'statistics' => 'statistics' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -176,9 +192,9 @@ public static function swaggerFormats() 'statistics' => 'setStatistics' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -206,21 +222,47 @@ public static function swaggerFormats() 'statistics' => 'getStatistics' ]; + /** + * 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 TYPE_CLASSIC = 'classic'; const TYPE_TRIGGER = 'trigger'; const STATUS_DRAFT = 'draft'; @@ -234,6 +276,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -246,6 +289,7 @@ public function getTypeAllowableValues() /** * Gets allowable values of the enum + * * @return string[] */ public function getStatusAllowableValues() @@ -263,13 +307,16 @@ public function getStatusAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -298,83 +345,86 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['subject'] === null) { - $invalid_properties[] = "'subject' can't be null"; + $invalidProperties[] = "'subject' can't be null"; } if ($this->container['type'] === null) { - $invalid_properties[] = "'type' can't be null"; + $invalidProperties[] = "'type' can't be null"; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['status'] === null) { - $invalid_properties[] = "'status' can't be null"; + $invalidProperties[] = "'status' can't be null"; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['testSent'] === null) { - $invalid_properties[] = "'testSent' can't be null"; + $invalidProperties[] = "'testSent' can't be null"; } if ($this->container['header'] === null) { - $invalid_properties[] = "'header' can't be null"; + $invalidProperties[] = "'header' can't be null"; } if ($this->container['footer'] === null) { - $invalid_properties[] = "'footer' can't be null"; + $invalidProperties[] = "'footer' can't be null"; + } + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; } if ($this->container['replyTo'] === null) { - $invalid_properties[] = "'replyTo' can't be null"; + $invalidProperties[] = "'replyTo' can't be null"; } if ($this->container['toField'] === null) { - $invalid_properties[] = "'toField' can't be null"; + $invalidProperties[] = "'toField' can't be null"; } if ($this->container['htmlContent'] === null) { - $invalid_properties[] = "'htmlContent' can't be null"; + $invalidProperties[] = "'htmlContent' can't be null"; } if ($this->container['tag'] === null) { - $invalid_properties[] = "'tag' can't be null"; + $invalidProperties[] = "'tag' can't be null"; } if ($this->container['createdAt'] === null) { - $invalid_properties[] = "'createdAt' can't be null"; + $invalidProperties[] = "'createdAt' can't be null"; } if ($this->container['modifiedAt'] === null) { - $invalid_properties[] = "'modifiedAt' can't be null"; + $invalidProperties[] = "'modifiedAt' can't be null"; } if ($this->container['recipients'] === null) { - $invalid_properties[] = "'recipients' can't be null"; + $invalidProperties[] = "'recipients' can't be null"; } if ($this->container['statistics'] === null) { - $invalid_properties[] = "'statistics' can't be null"; + $invalidProperties[] = "'statistics' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -394,15 +444,15 @@ public function valid() if ($this->container['type'] === null) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } if ($this->container['status'] === null) { return false; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { return false; } if ($this->container['testSent'] === null) { @@ -414,6 +464,9 @@ public function valid() if ($this->container['footer'] === null) { return false; } + if ($this->container['sender'] === null) { + return false; + } if ($this->container['replyTo'] === null) { return false; } @@ -444,6 +497,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -453,7 +507,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the campaign + * * @return $this */ public function setId($id) @@ -465,6 +521,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -474,7 +531,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the campaign + * * @return $this */ public function setName($name) @@ -486,6 +545,7 @@ public function setName($name) /** * Gets subject + * * @return string */ public function getSubject() @@ -495,7 +555,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the campaign + * * @return $this */ public function setSubject($subject) @@ -507,6 +569,7 @@ public function setSubject($subject) /** * Gets type + * * @return string */ public function getType() @@ -516,17 +579,19 @@ public function getType() /** * Sets type + * * @param string $type Type of campaign + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -537,6 +602,7 @@ public function setType($type) /** * Gets status + * * @return string */ public function getStatus() @@ -546,17 +612,19 @@ public function getStatus() /** * Sets status + * * @param string $status Status of the campaign + * * @return $this */ public function setStatus($status) { - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($status, $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -567,6 +635,7 @@ public function setStatus($status) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -576,7 +645,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -588,6 +659,7 @@ public function setScheduledAt($scheduledAt) /** * Gets testSent + * * @return bool */ public function getTestSent() @@ -597,7 +669,9 @@ public function getTestSent() /** * Sets testSent + * * @param bool $testSent Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) + * * @return $this */ public function setTestSent($testSent) @@ -609,6 +683,7 @@ public function setTestSent($testSent) /** * Gets header + * * @return string */ public function getHeader() @@ -618,7 +693,9 @@ public function getHeader() /** * Sets header + * * @param string $header Header of the campaign + * * @return $this */ public function setHeader($header) @@ -630,6 +707,7 @@ public function setHeader($header) /** * Gets footer + * * @return string */ public function getFooter() @@ -639,7 +717,9 @@ public function getFooter() /** * Sets footer + * * @param string $footer Footer of the campaign + * * @return $this */ public function setFooter($footer) @@ -651,6 +731,7 @@ public function setFooter($footer) /** * Gets sender + * * @return \SendinBlue\Client\Model\GetExtendedCampaignOverviewSender */ public function getSender() @@ -660,7 +741,9 @@ public function getSender() /** * Sets sender - * @param \SendinBlue\Client\Model\GetExtendedCampaignOverviewSender $sender + * + * @param \SendinBlue\Client\Model\GetExtendedCampaignOverviewSender $sender sender + * * @return $this */ public function setSender($sender) @@ -672,6 +755,7 @@ public function setSender($sender) /** * Gets replyTo + * * @return string */ public function getReplyTo() @@ -681,7 +765,9 @@ public function getReplyTo() /** * Sets replyTo + * * @param string $replyTo Email defined as the \"Reply to\" of the campaign + * * @return $this */ public function setReplyTo($replyTo) @@ -693,6 +779,7 @@ public function setReplyTo($replyTo) /** * Gets toField + * * @return string */ public function getToField() @@ -702,7 +789,9 @@ public function getToField() /** * Sets toField + * * @param string $toField Customisation of the \"to\" field of the campaign + * * @return $this */ public function setToField($toField) @@ -714,6 +803,7 @@ public function setToField($toField) /** * Gets htmlContent + * * @return string */ public function getHtmlContent() @@ -723,7 +813,9 @@ public function getHtmlContent() /** * Sets htmlContent + * * @param string $htmlContent HTML content of the campaign + * * @return $this */ public function setHtmlContent($htmlContent) @@ -735,6 +827,7 @@ public function setHtmlContent($htmlContent) /** * Gets shareLink + * * @return string */ public function getShareLink() @@ -744,7 +837,9 @@ public function getShareLink() /** * Sets shareLink + * * @param string $shareLink Link to share the campaign on social medias + * * @return $this */ public function setShareLink($shareLink) @@ -756,6 +851,7 @@ public function setShareLink($shareLink) /** * Gets tag + * * @return string */ public function getTag() @@ -765,7 +861,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the campaign + * * @return $this */ public function setTag($tag) @@ -777,6 +875,7 @@ public function setTag($tag) /** * Gets createdAt + * * @return \DateTime */ public function getCreatedAt() @@ -786,7 +885,9 @@ public function getCreatedAt() /** * Sets createdAt + * * @param \DateTime $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setCreatedAt($createdAt) @@ -798,6 +899,7 @@ public function setCreatedAt($createdAt) /** * Gets modifiedAt + * * @return \DateTime */ public function getModifiedAt() @@ -807,7 +909,9 @@ public function getModifiedAt() /** * Sets modifiedAt + * * @param \DateTime $modifiedAt UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setModifiedAt($modifiedAt) @@ -819,6 +923,7 @@ public function setModifiedAt($modifiedAt) /** * Gets inlineImageActivation + * * @return bool */ public function getInlineImageActivation() @@ -828,7 +933,9 @@ public function getInlineImageActivation() /** * Sets inlineImageActivation + * * @param bool $inlineImageActivation Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email. + * * @return $this */ public function setInlineImageActivation($inlineImageActivation) @@ -840,6 +947,7 @@ public function setInlineImageActivation($inlineImageActivation) /** * Gets mirrorActive + * * @return bool */ public function getMirrorActive() @@ -849,7 +957,9 @@ public function getMirrorActive() /** * Sets mirrorActive + * * @param bool $mirrorActive Status of mirror links in campaign. mirrorActive = false means mirror links are deactivated, & mirrorActive = true means mirror links are activated, in the campaign + * * @return $this */ public function setMirrorActive($mirrorActive) @@ -861,6 +971,7 @@ public function setMirrorActive($mirrorActive) /** * Gets recurring + * * @return bool */ public function getRecurring() @@ -870,7 +981,9 @@ public function getRecurring() /** * Sets recurring + * * @param bool $recurring FOR TRIGGER ONLY ! Type of trigger campaign.recurring = false means contact can receive the same Trigger campaign only once, & recurring = true means contact can receive the same Trigger campaign several times + * * @return $this */ public function setRecurring($recurring) @@ -882,6 +995,7 @@ public function setRecurring($recurring) /** * Gets recipients + * * @return object */ public function getRecipients() @@ -891,7 +1005,9 @@ public function getRecipients() /** * Sets recipients - * @param object $recipients + * + * @param object $recipients recipients + * * @return $this */ public function setRecipients($recipients) @@ -903,6 +1019,7 @@ public function setRecipients($recipients) /** * Gets statistics + * * @return object */ public function getStatistics() @@ -912,7 +1029,9 @@ public function getStatistics() /** * Sets statistics - * @param object $statistics + * + * @param object $statistics statistics + * * @return $this */ public function setStatistics($statistics) @@ -923,7 +1042,9 @@ public function setStatistics($statistics) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -933,7 +1054,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -943,8 +1066,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -958,7 +1083,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -968,15 +1095,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetEmailCampaigns.php b/lib/Model/GetEmailCampaigns.php index 0f441353..ba26222b 100644 --- a/lib/Model/GetEmailCampaigns.php +++ b/lib/Model/GetEmailCampaigns.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetEmailCampaigns Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetEmailCampaigns implements ArrayAccess +class GetEmailCampaigns implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getEmailCampaigns'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetEmailCampaigns implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetEmailCampaigns implements ArrayAccess 'count' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'count' => 'count' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'count' => 'setCount' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'count' => 'getCount' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +187,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets campaigns + * * @return object[] */ public function getCampaigns() @@ -183,7 +229,9 @@ public function getCampaigns() /** * Sets campaigns - * @param object[] $campaigns + * + * @param object[] $campaigns campaigns + * * @return $this */ public function setCampaigns($campaigns) @@ -195,6 +243,7 @@ public function setCampaigns($campaigns) /** * Gets count + * * @return int */ public function getCount() @@ -204,7 +253,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of Email campaigns retrieved + * * @return $this */ public function setCount($count) @@ -215,7 +266,9 @@ public function setCount($count) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +278,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +307,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +319,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetEmailEventReport.php b/lib/Model/GetEmailEventReport.php index 702870bf..4c2c1698 100644 --- a/lib/Model/GetEmailEventReport.php +++ b/lib/Model/GetEmailEventReport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetEmailEventReport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetEmailEventReport implements ArrayAccess +class GetEmailEventReport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getEmailEventReport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetEmailEventReport implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'events' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'events' => 'events' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'events' => 'setEvents' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'events' => 'getEvents' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets events + * * @return \SendinBlue\Client\Model\GetEmailEventReportEvents[] */ public function getEvents() @@ -171,7 +217,9 @@ public function getEvents() /** * Sets events - * @param \SendinBlue\Client\Model\GetEmailEventReportEvents[] $events + * + * @param \SendinBlue\Client\Model\GetEmailEventReportEvents[] $events events + * * @return $this */ public function setEvents($events) @@ -182,7 +230,9 @@ public function setEvents($events) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetEmailEventReportEvents.php b/lib/Model/GetEmailEventReportEvents.php index d3e7360e..2f546166 100644 --- a/lib/Model/GetEmailEventReportEvents.php +++ b/lib/Model/GetEmailEventReportEvents.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetEmailEventReportEvents Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetEmailEventReportEvents implements ArrayAccess +class GetEmailEventReportEvents implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getEmailEventReport_events'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -68,6 +71,7 @@ class GetEmailEventReportEvents implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -83,18 +87,30 @@ class GetEmailEventReportEvents implements ArrayAccess 'from' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -110,9 +126,9 @@ public static function swaggerFormats() 'from' => 'from' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -128,9 +144,9 @@ public static function swaggerFormats() 'from' => 'setFrom' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -146,21 +162,47 @@ public static function swaggerFormats() 'from' => 'getFrom' ]; + /** + * 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 EVENT_BOUNCES = 'bounces'; const EVENT_HARD_BOUNCES = 'hardBounces'; const EVENT_SOFT_BOUNCES = 'softBounces'; @@ -177,6 +219,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getEventAllowableValues() @@ -199,13 +242,16 @@ public function getEventAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -222,39 +268,39 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['date'] === null) { - $invalid_properties[] = "'date' can't be null"; + $invalidProperties[] = "'date' can't be null"; } if ($this->container['messageId'] === null) { - $invalid_properties[] = "'messageId' can't be null"; + $invalidProperties[] = "'messageId' can't be null"; } if ($this->container['event'] === null) { - $invalid_properties[] = "'event' can't be null"; + $invalidProperties[] = "'event' can't be null"; } - $allowed_values = $this->getEventAllowableValues(); - if (!in_array($this->container['event'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($this->container['event'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'event', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -274,8 +320,8 @@ public function valid() if ($this->container['event'] === null) { return false; } - $allowed_values = $this->getEventAllowableValues(); - if (!in_array($this->container['event'], $allowed_values)) { + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($this->container['event'], $allowedValues)) { return false; } return true; @@ -284,6 +330,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -293,7 +340,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email address which generates the event + * * @return $this */ public function setEmail($email) @@ -305,6 +354,7 @@ public function setEmail($email) /** * Gets date + * * @return \DateTime */ public function getDate() @@ -314,7 +364,9 @@ public function getDate() /** * Sets date + * * @param \DateTime $date UTC date-time on which the event has been generated + * * @return $this */ public function setDate($date) @@ -326,6 +378,7 @@ public function setDate($date) /** * Gets subject + * * @return string */ public function getSubject() @@ -335,7 +388,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the event + * * @return $this */ public function setSubject($subject) @@ -347,6 +402,7 @@ public function setSubject($subject) /** * Gets messageId + * * @return string */ public function getMessageId() @@ -356,7 +412,9 @@ public function getMessageId() /** * Sets messageId + * * @param string $messageId Message ID which generated the event + * * @return $this */ public function setMessageId($messageId) @@ -368,6 +426,7 @@ public function setMessageId($messageId) /** * Gets event + * * @return string */ public function getEvent() @@ -377,17 +436,19 @@ public function getEvent() /** * Sets event + * * @param string $event Event which occurred + * * @return $this */ public function setEvent($event) { - $allowed_values = $this->getEventAllowableValues(); - if (!in_array($event, $allowed_values)) { + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($event, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'event', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -398,6 +459,7 @@ public function setEvent($event) /** * Gets reason + * * @return string */ public function getReason() @@ -407,7 +469,9 @@ public function getReason() /** * Sets reason + * * @param string $reason Reason of bounce (only available if the event is hardbounce or softbounce) + * * @return $this */ public function setReason($reason) @@ -419,6 +483,7 @@ public function setReason($reason) /** * Gets tag + * * @return string */ public function getTag() @@ -428,7 +493,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the email which generated the event + * * @return $this */ public function setTag($tag) @@ -440,6 +507,7 @@ public function setTag($tag) /** * Gets ip + * * @return string */ public function getIp() @@ -449,7 +517,9 @@ public function getIp() /** * Sets ip + * * @param string $ip IP from which the user has opened the email or clicked on the link (only available if the event is opened or clicks) + * * @return $this */ public function setIp($ip) @@ -461,6 +531,7 @@ public function setIp($ip) /** * Gets link + * * @return string */ public function getLink() @@ -470,7 +541,9 @@ public function getLink() /** * Sets link + * * @param string $link The link which is sent to the user (only available if the event is requests or opened or clicks) + * * @return $this */ public function setLink($link) @@ -482,6 +555,7 @@ public function setLink($link) /** * Gets from + * * @return string */ public function getFrom() @@ -491,7 +565,9 @@ public function getFrom() /** * Sets from + * * @param string $from Sender email from which the emails are sent + * * @return $this */ public function setFrom($from) @@ -502,7 +578,9 @@ public function setFrom($from) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -512,7 +590,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -522,8 +602,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -537,7 +619,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -547,15 +631,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedCampaignOverview.php b/lib/Model/GetExtendedCampaignOverview.php index ad1a774a..6b195dfb 100644 --- a/lib/Model/GetExtendedCampaignOverview.php +++ b/lib/Model/GetExtendedCampaignOverview.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedCampaignOverview Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedCampaignOverview implements ArrayAccess +class GetExtendedCampaignOverview implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedCampaignOverview'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -78,6 +81,7 @@ class GetExtendedCampaignOverview implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -103,18 +107,30 @@ class GetExtendedCampaignOverview implements ArrayAccess 'recurring' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -140,9 +156,9 @@ public static function swaggerFormats() 'recurring' => 'recurring' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -168,9 +184,9 @@ public static function swaggerFormats() 'recurring' => 'setRecurring' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -196,21 +212,47 @@ public static function swaggerFormats() 'recurring' => 'getRecurring' ]; + /** + * 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 TYPE_CLASSIC = 'classic'; const TYPE_TRIGGER = 'trigger'; const STATUS_DRAFT = 'draft'; @@ -224,6 +266,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -236,6 +279,7 @@ public function getTypeAllowableValues() /** * Gets allowable values of the enum + * * @return string[] */ public function getStatusAllowableValues() @@ -253,13 +297,16 @@ public function getStatusAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -286,77 +333,80 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['subject'] === null) { - $invalid_properties[] = "'subject' can't be null"; + $invalidProperties[] = "'subject' can't be null"; } if ($this->container['type'] === null) { - $invalid_properties[] = "'type' can't be null"; + $invalidProperties[] = "'type' can't be null"; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['status'] === null) { - $invalid_properties[] = "'status' can't be null"; + $invalidProperties[] = "'status' can't be null"; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['testSent'] === null) { - $invalid_properties[] = "'testSent' can't be null"; + $invalidProperties[] = "'testSent' can't be null"; } if ($this->container['header'] === null) { - $invalid_properties[] = "'header' can't be null"; + $invalidProperties[] = "'header' can't be null"; } if ($this->container['footer'] === null) { - $invalid_properties[] = "'footer' can't be null"; + $invalidProperties[] = "'footer' can't be null"; + } + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; } if ($this->container['replyTo'] === null) { - $invalid_properties[] = "'replyTo' can't be null"; + $invalidProperties[] = "'replyTo' can't be null"; } if ($this->container['toField'] === null) { - $invalid_properties[] = "'toField' can't be null"; + $invalidProperties[] = "'toField' can't be null"; } if ($this->container['htmlContent'] === null) { - $invalid_properties[] = "'htmlContent' can't be null"; + $invalidProperties[] = "'htmlContent' can't be null"; } if ($this->container['tag'] === null) { - $invalid_properties[] = "'tag' can't be null"; + $invalidProperties[] = "'tag' can't be null"; } if ($this->container['createdAt'] === null) { - $invalid_properties[] = "'createdAt' can't be null"; + $invalidProperties[] = "'createdAt' can't be null"; } if ($this->container['modifiedAt'] === null) { - $invalid_properties[] = "'modifiedAt' can't be null"; + $invalidProperties[] = "'modifiedAt' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -376,15 +426,15 @@ public function valid() if ($this->container['type'] === null) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } if ($this->container['status'] === null) { return false; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { return false; } if ($this->container['testSent'] === null) { @@ -396,6 +446,9 @@ public function valid() if ($this->container['footer'] === null) { return false; } + if ($this->container['sender'] === null) { + return false; + } if ($this->container['replyTo'] === null) { return false; } @@ -420,6 +473,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -429,7 +483,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the campaign + * * @return $this */ public function setId($id) @@ -441,6 +497,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -450,7 +507,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the campaign + * * @return $this */ public function setName($name) @@ -462,6 +521,7 @@ public function setName($name) /** * Gets subject + * * @return string */ public function getSubject() @@ -471,7 +531,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the campaign + * * @return $this */ public function setSubject($subject) @@ -483,6 +545,7 @@ public function setSubject($subject) /** * Gets type + * * @return string */ public function getType() @@ -492,17 +555,19 @@ public function getType() /** * Sets type + * * @param string $type Type of campaign + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -513,6 +578,7 @@ public function setType($type) /** * Gets status + * * @return string */ public function getStatus() @@ -522,17 +588,19 @@ public function getStatus() /** * Sets status + * * @param string $status Status of the campaign + * * @return $this */ public function setStatus($status) { - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($status, $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -543,6 +611,7 @@ public function setStatus($status) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -552,7 +621,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt UTC date-time on which campaign is scheduled (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -564,6 +635,7 @@ public function setScheduledAt($scheduledAt) /** * Gets testSent + * * @return bool */ public function getTestSent() @@ -573,7 +645,9 @@ public function getTestSent() /** * Sets testSent + * * @param bool $testSent Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) + * * @return $this */ public function setTestSent($testSent) @@ -585,6 +659,7 @@ public function setTestSent($testSent) /** * Gets header + * * @return string */ public function getHeader() @@ -594,7 +669,9 @@ public function getHeader() /** * Sets header + * * @param string $header Header of the campaign + * * @return $this */ public function setHeader($header) @@ -606,6 +683,7 @@ public function setHeader($header) /** * Gets footer + * * @return string */ public function getFooter() @@ -615,7 +693,9 @@ public function getFooter() /** * Sets footer + * * @param string $footer Footer of the campaign + * * @return $this */ public function setFooter($footer) @@ -627,6 +707,7 @@ public function setFooter($footer) /** * Gets sender + * * @return \SendinBlue\Client\Model\GetExtendedCampaignOverviewSender */ public function getSender() @@ -636,7 +717,9 @@ public function getSender() /** * Sets sender - * @param \SendinBlue\Client\Model\GetExtendedCampaignOverviewSender $sender + * + * @param \SendinBlue\Client\Model\GetExtendedCampaignOverviewSender $sender sender + * * @return $this */ public function setSender($sender) @@ -648,6 +731,7 @@ public function setSender($sender) /** * Gets replyTo + * * @return string */ public function getReplyTo() @@ -657,7 +741,9 @@ public function getReplyTo() /** * Sets replyTo + * * @param string $replyTo Email defined as the \"Reply to\" of the campaign + * * @return $this */ public function setReplyTo($replyTo) @@ -669,6 +755,7 @@ public function setReplyTo($replyTo) /** * Gets toField + * * @return string */ public function getToField() @@ -678,7 +765,9 @@ public function getToField() /** * Sets toField + * * @param string $toField Customisation of the \"to\" field of the campaign + * * @return $this */ public function setToField($toField) @@ -690,6 +779,7 @@ public function setToField($toField) /** * Gets htmlContent + * * @return string */ public function getHtmlContent() @@ -699,7 +789,9 @@ public function getHtmlContent() /** * Sets htmlContent + * * @param string $htmlContent HTML content of the campaign + * * @return $this */ public function setHtmlContent($htmlContent) @@ -711,6 +803,7 @@ public function setHtmlContent($htmlContent) /** * Gets shareLink + * * @return string */ public function getShareLink() @@ -720,7 +813,9 @@ public function getShareLink() /** * Sets shareLink + * * @param string $shareLink Link to share the campaign on social medias + * * @return $this */ public function setShareLink($shareLink) @@ -732,6 +827,7 @@ public function setShareLink($shareLink) /** * Gets tag + * * @return string */ public function getTag() @@ -741,7 +837,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the campaign + * * @return $this */ public function setTag($tag) @@ -753,6 +851,7 @@ public function setTag($tag) /** * Gets createdAt + * * @return \DateTime */ public function getCreatedAt() @@ -762,7 +861,9 @@ public function getCreatedAt() /** * Sets createdAt + * * @param \DateTime $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setCreatedAt($createdAt) @@ -774,6 +875,7 @@ public function setCreatedAt($createdAt) /** * Gets modifiedAt + * * @return \DateTime */ public function getModifiedAt() @@ -783,7 +885,9 @@ public function getModifiedAt() /** * Sets modifiedAt + * * @param \DateTime $modifiedAt UTC date-time of last modification of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setModifiedAt($modifiedAt) @@ -795,6 +899,7 @@ public function setModifiedAt($modifiedAt) /** * Gets inlineImageActivation + * * @return bool */ public function getInlineImageActivation() @@ -804,7 +909,9 @@ public function getInlineImageActivation() /** * Sets inlineImageActivation + * * @param bool $inlineImageActivation Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email. + * * @return $this */ public function setInlineImageActivation($inlineImageActivation) @@ -816,6 +923,7 @@ public function setInlineImageActivation($inlineImageActivation) /** * Gets mirrorActive + * * @return bool */ public function getMirrorActive() @@ -825,7 +933,9 @@ public function getMirrorActive() /** * Sets mirrorActive + * * @param bool $mirrorActive Status of mirror links in campaign. mirrorActive = false means mirror links are deactivated, & mirrorActive = true means mirror links are activated, in the campaign + * * @return $this */ public function setMirrorActive($mirrorActive) @@ -837,6 +947,7 @@ public function setMirrorActive($mirrorActive) /** * Gets recurring + * * @return bool */ public function getRecurring() @@ -846,7 +957,9 @@ public function getRecurring() /** * Sets recurring + * * @param bool $recurring FOR TRIGGER ONLY ! Type of trigger campaign.recurring = false means contact can receive the same Trigger campaign only once, & recurring = true means contact can receive the same Trigger campaign several times + * * @return $this */ public function setRecurring($recurring) @@ -857,7 +970,9 @@ public function setRecurring($recurring) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -867,7 +982,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -877,8 +994,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -892,7 +1011,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -902,15 +1023,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedCampaignOverviewSender.php b/lib/Model/GetExtendedCampaignOverviewSender.php index f0048df2..e74743c1 100644 --- a/lib/Model/GetExtendedCampaignOverviewSender.php +++ b/lib/Model/GetExtendedCampaignOverviewSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedCampaignOverviewSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedCampaignOverviewSender implements ArrayAccess +class GetExtendedCampaignOverviewSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedCampaignOverview_sender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetExtendedCampaignOverviewSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetExtendedCampaignOverviewSender implements ArrayAccess 'email' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -177,7 +223,9 @@ public function getName() /** * Sets name + * * @param string $name Sender name of the campaign + * * @return $this */ public function setName($name) @@ -189,6 +237,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -198,7 +247,9 @@ public function getEmail() /** * Sets email + * * @param string $email Sender email of the campaign + * * @return $this */ public function setEmail($email) @@ -209,7 +260,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedCampaignStats.php b/lib/Model/GetExtendedCampaignStats.php index c8e4ae61..8d1d649e 100644 --- a/lib/Model/GetExtendedCampaignStats.php +++ b/lib/Model/GetExtendedCampaignStats.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,42 +30,48 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedCampaignStats Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedCampaignStats implements ArrayAccess +class GetExtendedCampaignStats implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedCampaignStats'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ + 'globalStats' => 'object', 'campaignStats' => 'object[]', 'mirrorClick' => 'int', 'remaining' => 'int', - 'linksStats' => 'map[string,\SendinBlue\Client\Model\GetExtendedCampaignStatsLinksStats]', + 'linksStats' => 'object', 'statsByDomain' => '\SendinBlue\Client\Model\GetStatsByDomain' ]; /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ + 'globalStats' => null, 'campaignStats' => null, 'mirrorClick' => 'int64', 'remaining' => 'int64', @@ -73,21 +79,34 @@ class GetExtendedCampaignStats implements ArrayAccess 'statsByDomain' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ + 'globalStats' => 'globalStats', 'campaignStats' => 'campaignStats', 'mirrorClick' => 'mirrorClick', 'remaining' => 'remaining', @@ -95,12 +114,13 @@ public static function swaggerFormats() 'statsByDomain' => 'statsByDomain' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ + 'globalStats' => 'setGlobalStats', 'campaignStats' => 'setCampaignStats', 'mirrorClick' => 'setMirrorClick', 'remaining' => 'setRemaining', @@ -108,12 +128,13 @@ public static function swaggerFormats() 'statsByDomain' => 'setStatsByDomain' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ + 'globalStats' => 'getGlobalStats', 'campaignStats' => 'getCampaignStats', 'mirrorClick' => 'getMirrorClick', 'remaining' => 'getRemaining', @@ -121,37 +142,67 @@ public static function swaggerFormats() 'statsByDomain' => 'getStatsByDomain' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { + $this->container['globalStats'] = isset($data['globalStats']) ? $data['globalStats'] : null; $this->container['campaignStats'] = isset($data['campaignStats']) ? $data['campaignStats'] : null; $this->container['mirrorClick'] = isset($data['mirrorClick']) ? $data['mirrorClick'] : null; $this->container['remaining'] = isset($data['remaining']) ? $data['remaining'] : null; @@ -160,34 +211,37 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; + if ($this->container['globalStats'] === null) { + $invalidProperties[] = "'globalStats' can't be null"; + } if ($this->container['campaignStats'] === null) { - $invalid_properties[] = "'campaignStats' can't be null"; + $invalidProperties[] = "'campaignStats' can't be null"; } if ($this->container['mirrorClick'] === null) { - $invalid_properties[] = "'mirrorClick' can't be null"; + $invalidProperties[] = "'mirrorClick' can't be null"; } if ($this->container['remaining'] === null) { - $invalid_properties[] = "'remaining' can't be null"; + $invalidProperties[] = "'remaining' can't be null"; } if ($this->container['linksStats'] === null) { - $invalid_properties[] = "'linksStats' can't be null"; + $invalidProperties[] = "'linksStats' can't be null"; } if ($this->container['statsByDomain'] === null) { - $invalid_properties[] = "'statsByDomain' can't be null"; + $invalidProperties[] = "'statsByDomain' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -195,6 +249,9 @@ public function listInvalidProperties() public function valid() { + if ($this->container['globalStats'] === null) { + return false; + } if ($this->container['campaignStats'] === null) { return false; } @@ -214,8 +271,33 @@ public function valid() } + /** + * Gets globalStats + * + * @return object + */ + public function getGlobalStats() + { + return $this->container['globalStats']; + } + + /** + * Sets globalStats + * + * @param object $globalStats Overall statistics of the campaign + * + * @return $this + */ + public function setGlobalStats($globalStats) + { + $this->container['globalStats'] = $globalStats; + + return $this; + } + /** * Gets campaignStats + * * @return object[] */ public function getCampaignStats() @@ -225,7 +307,9 @@ public function getCampaignStats() /** * Sets campaignStats - * @param object[] $campaignStats + * + * @param object[] $campaignStats List-wise statistics of the campaign. + * * @return $this */ public function setCampaignStats($campaignStats) @@ -237,6 +321,7 @@ public function setCampaignStats($campaignStats) /** * Gets mirrorClick + * * @return int */ public function getMirrorClick() @@ -246,7 +331,9 @@ public function getMirrorClick() /** * Sets mirrorClick + * * @param int $mirrorClick Number of clicks on mirror link + * * @return $this */ public function setMirrorClick($mirrorClick) @@ -258,6 +345,7 @@ public function setMirrorClick($mirrorClick) /** * Gets remaining + * * @return int */ public function getRemaining() @@ -267,7 +355,9 @@ public function getRemaining() /** * Sets remaining + * * @param int $remaining Number of remaning emails to send + * * @return $this */ public function setRemaining($remaining) @@ -279,7 +369,8 @@ public function setRemaining($remaining) /** * Gets linksStats - * @return map[string,\SendinBlue\Client\Model\GetExtendedCampaignStatsLinksStats] + * + * @return object */ public function getLinksStats() { @@ -288,7 +379,9 @@ public function getLinksStats() /** * Sets linksStats - * @param map[string,\SendinBlue\Client\Model\GetExtendedCampaignStatsLinksStats] $linksStats + * + * @param object $linksStats Statistics about the number of clicks for the links + * * @return $this */ public function setLinksStats($linksStats) @@ -300,6 +393,7 @@ public function setLinksStats($linksStats) /** * Gets statsByDomain + * * @return \SendinBlue\Client\Model\GetStatsByDomain */ public function getStatsByDomain() @@ -309,7 +403,9 @@ public function getStatsByDomain() /** * Sets statsByDomain - * @param \SendinBlue\Client\Model\GetStatsByDomain $statsByDomain + * + * @param \SendinBlue\Client\Model\GetStatsByDomain $statsByDomain statsByDomain + * * @return $this */ public function setStatsByDomain($statsByDomain) @@ -320,7 +416,9 @@ public function setStatsByDomain($statsByDomain) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -330,7 +428,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -340,8 +440,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -355,7 +457,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -365,15 +469,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedCampaignStatsLinksStats.php b/lib/Model/GetExtendedCampaignStatsLinksStats.php deleted file mode 100644 index 98353aa6..00000000 --- a/lib/Model/GetExtendedCampaignStatsLinksStats.php +++ /dev/null @@ -1,249 +0,0 @@ - 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * @var string[] - */ - protected static $swaggerFormats = [ - 'nbClick' => 'int64' - ]; - - public static function swaggerTypes() - { - return self::$swaggerTypes; - } - - 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 = [ - 'nbClick' => 'nbClick' - ]; - - - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - protected static $setters = [ - 'nbClick' => 'setNbClick' - ]; - - - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - protected static $getters = [ - 'nbClick' => 'getNbClick' - ]; - - public static function attributeMap() - { - return self::$attributeMap; - } - - public static function setters() - { - return self::$setters; - } - - public static function getters() - { - return self::$getters; - } - - - - - - /** - * 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['nbClick'] = isset($data['nbClick']) ? $data['nbClick'] : null; - } - - /** - * show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalid_properties = []; - - if ($this->container['nbClick'] === null) { - $invalid_properties[] = "'nbClick' can't be null"; - } - return $invalid_properties; - } - - /** - * validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - - if ($this->container['nbClick'] === null) { - return false; - } - return true; - } - - - /** - * Gets nbClick - * @return int - */ - public function getNbClick() - { - return $this->container['nbClick']; - } - - /** - * Sets nbClick - * @param int $nbClick Number of clicks for the link - * @return $this - */ - public function setNbClick($nbClick) - { - $this->container['nbClick'] = $nbClick; - - 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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); - } - - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/GetExtendedClient.php b/lib/Model/GetExtendedClient.php index 5465cd14..bb411250 100644 --- a/lib/Model/GetExtendedClient.php +++ b/lib/Model/GetExtendedClient.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedClient Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedClient implements ArrayAccess +class GetExtendedClient implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedClient'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class GetExtendedClient implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class GetExtendedClient implements ArrayAccess 'address' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'address' => 'address' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'address' => 'setAddress' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,34 +137,63 @@ public static function swaggerFormats() 'address' => 'getAddress' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -160,31 +205,34 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['firstName'] === null) { - $invalid_properties[] = "'firstName' can't be null"; + $invalidProperties[] = "'firstName' can't be null"; } if ($this->container['lastName'] === null) { - $invalid_properties[] = "'lastName' can't be null"; + $invalidProperties[] = "'lastName' can't be null"; } if ($this->container['companyName'] === null) { - $invalid_properties[] = "'companyName' can't be null"; + $invalidProperties[] = "'companyName' can't be null"; } - return $invalid_properties; + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; + } + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -204,12 +252,16 @@ public function valid() if ($this->container['companyName'] === null) { return false; } + if ($this->container['address'] === null) { + return false; + } return true; } /** * Gets email + * * @return string */ public function getEmail() @@ -219,7 +271,9 @@ public function getEmail() /** * Sets email + * * @param string $email Login Email + * * @return $this */ public function setEmail($email) @@ -231,6 +285,7 @@ public function setEmail($email) /** * Gets firstName + * * @return string */ public function getFirstName() @@ -240,7 +295,9 @@ public function getFirstName() /** * Sets firstName + * * @param string $firstName First Name + * * @return $this */ public function setFirstName($firstName) @@ -252,6 +309,7 @@ public function setFirstName($firstName) /** * Gets lastName + * * @return string */ public function getLastName() @@ -261,7 +319,9 @@ public function getLastName() /** * Sets lastName + * * @param string $lastName Last Name + * * @return $this */ public function setLastName($lastName) @@ -273,6 +333,7 @@ public function setLastName($lastName) /** * Gets companyName + * * @return string */ public function getCompanyName() @@ -282,7 +343,9 @@ public function getCompanyName() /** * Sets companyName + * * @param string $companyName Name of the company + * * @return $this */ public function setCompanyName($companyName) @@ -294,6 +357,7 @@ public function setCompanyName($companyName) /** * Gets address + * * @return \SendinBlue\Client\Model\GetExtendedClientAddress */ public function getAddress() @@ -303,7 +367,9 @@ public function getAddress() /** * Sets address - * @param \SendinBlue\Client\Model\GetExtendedClientAddress $address + * + * @param \SendinBlue\Client\Model\GetExtendedClientAddress $address address + * * @return $this */ public function setAddress($address) @@ -314,7 +380,9 @@ public function setAddress($address) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -324,7 +392,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -334,8 +404,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -349,7 +421,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -359,15 +433,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedClientAddress.php b/lib/Model/GetExtendedClientAddress.php index 2ee7d77f..be071591 100644 --- a/lib/Model/GetExtendedClientAddress.php +++ b/lib/Model/GetExtendedClientAddress.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedClientAddress Class Doc Comment * - * @category Class + * @category Class * @description Address informations - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedClientAddress implements ArrayAccess +class GetExtendedClientAddress implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedClient_address'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class GetExtendedClientAddress implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -72,18 +76,30 @@ class GetExtendedClientAddress implements ArrayAccess 'country' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -93,9 +109,9 @@ public static function swaggerFormats() 'country' => 'country' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -105,9 +121,9 @@ public static function swaggerFormats() 'country' => 'setCountry' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -117,34 +133,63 @@ public static function swaggerFormats() 'country' => 'getCountry' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -155,31 +200,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['street'] === null) { - $invalid_properties[] = "'street' can't be null"; + $invalidProperties[] = "'street' can't be null"; } if ($this->container['city'] === null) { - $invalid_properties[] = "'city' can't be null"; + $invalidProperties[] = "'city' can't be null"; } if ($this->container['zipCode'] === null) { - $invalid_properties[] = "'zipCode' can't be null"; + $invalidProperties[] = "'zipCode' can't be null"; } if ($this->container['country'] === null) { - $invalid_properties[] = "'country' can't be null"; + $invalidProperties[] = "'country' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -205,6 +250,7 @@ public function valid() /** * Gets street + * * @return string */ public function getStreet() @@ -214,7 +260,9 @@ public function getStreet() /** * Sets street + * * @param string $street Street information + * * @return $this */ public function setStreet($street) @@ -226,6 +274,7 @@ public function setStreet($street) /** * Gets city + * * @return string */ public function getCity() @@ -235,7 +284,9 @@ public function getCity() /** * Sets city + * * @param string $city City information + * * @return $this */ public function setCity($city) @@ -247,6 +298,7 @@ public function setCity($city) /** * Gets zipCode + * * @return string */ public function getZipCode() @@ -256,7 +308,9 @@ public function getZipCode() /** * Sets zipCode + * * @param string $zipCode Zip Code information + * * @return $this */ public function setZipCode($zipCode) @@ -268,6 +322,7 @@ public function setZipCode($zipCode) /** * Gets country + * * @return string */ public function getCountry() @@ -277,7 +332,9 @@ public function getCountry() /** * Sets country + * * @param string $country Country information + * * @return $this */ public function setCountry($country) @@ -288,7 +345,9 @@ public function setCountry($country) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -298,7 +357,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -308,8 +369,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -323,7 +386,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -333,15 +398,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetails.php b/lib/Model/GetExtendedContactDetails.php index 47c01424..2b98f03b 100644 --- a/lib/Model/GetExtendedContactDetails.php +++ b/lib/Model/GetExtendedContactDetails.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetails Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetails implements ArrayAccess +class GetExtendedContactDetails implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,12 +64,13 @@ class GetExtendedContactDetails implements ArrayAccess 'modifiedAt' => '\DateTime', 'listIds' => 'int[]', 'listUnsubscribed' => 'int[]', - 'attributes' => 'map[string,string]', + 'attributes' => 'object', 'statistics' => '\SendinBlue\Client\Model\GetExtendedContactDetailsStatistics' ]; /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -81,18 +85,30 @@ class GetExtendedContactDetails implements ArrayAccess 'statistics' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -107,9 +123,9 @@ public static function swaggerFormats() 'statistics' => 'statistics' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -124,9 +140,9 @@ public static function swaggerFormats() 'statistics' => 'setStatistics' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -141,34 +157,63 @@ public static function swaggerFormats() 'statistics' => 'getStatistics' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -184,40 +229,43 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['emailBlacklisted'] === null) { - $invalid_properties[] = "'emailBlacklisted' can't be null"; + $invalidProperties[] = "'emailBlacklisted' can't be null"; } if ($this->container['smsBlacklisted'] === null) { - $invalid_properties[] = "'smsBlacklisted' can't be null"; + $invalidProperties[] = "'smsBlacklisted' can't be null"; } if ($this->container['modifiedAt'] === null) { - $invalid_properties[] = "'modifiedAt' can't be null"; + $invalidProperties[] = "'modifiedAt' can't be null"; } if ($this->container['listIds'] === null) { - $invalid_properties[] = "'listIds' can't be null"; + $invalidProperties[] = "'listIds' can't be null"; } if ($this->container['attributes'] === null) { - $invalid_properties[] = "'attributes' can't be null"; + $invalidProperties[] = "'attributes' can't be null"; } - return $invalid_properties; + if ($this->container['statistics'] === null) { + $invalidProperties[] = "'statistics' can't be null"; + } + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -246,12 +294,16 @@ public function valid() if ($this->container['attributes'] === null) { return false; } + if ($this->container['statistics'] === null) { + return false; + } return true; } /** * Gets email + * * @return string */ public function getEmail() @@ -261,7 +313,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email address of the contact for which you requested the details + * * @return $this */ public function setEmail($email) @@ -273,6 +327,7 @@ public function setEmail($email) /** * Gets id + * * @return int */ public function getId() @@ -282,7 +337,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the contact for which you requested the details + * * @return $this */ public function setId($id) @@ -294,6 +351,7 @@ public function setId($id) /** * Gets emailBlacklisted + * * @return bool */ public function getEmailBlacklisted() @@ -303,7 +361,9 @@ public function getEmailBlacklisted() /** * Sets emailBlacklisted + * * @param bool $emailBlacklisted Blacklist status for email campaigns (true=blacklisted, false=not blacklisted) + * * @return $this */ public function setEmailBlacklisted($emailBlacklisted) @@ -315,6 +375,7 @@ public function setEmailBlacklisted($emailBlacklisted) /** * Gets smsBlacklisted + * * @return bool */ public function getSmsBlacklisted() @@ -324,7 +385,9 @@ public function getSmsBlacklisted() /** * Sets smsBlacklisted + * * @param bool $smsBlacklisted Blacklist status for SMS campaigns (true=blacklisted, false=not blacklisted) + * * @return $this */ public function setSmsBlacklisted($smsBlacklisted) @@ -336,6 +399,7 @@ public function setSmsBlacklisted($smsBlacklisted) /** * Gets modifiedAt + * * @return \DateTime */ public function getModifiedAt() @@ -345,7 +409,9 @@ public function getModifiedAt() /** * Sets modifiedAt + * * @param \DateTime $modifiedAt Last modification UTC date-time of the contact (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setModifiedAt($modifiedAt) @@ -357,6 +423,7 @@ public function setModifiedAt($modifiedAt) /** * Gets listIds + * * @return int[] */ public function getListIds() @@ -366,7 +433,9 @@ public function getListIds() /** * Sets listIds - * @param int[] $listIds + * + * @param int[] $listIds listIds + * * @return $this */ public function setListIds($listIds) @@ -378,6 +447,7 @@ public function setListIds($listIds) /** * Gets listUnsubscribed + * * @return int[] */ public function getListUnsubscribed() @@ -387,7 +457,9 @@ public function getListUnsubscribed() /** * Sets listUnsubscribed - * @param int[] $listUnsubscribed + * + * @param int[] $listUnsubscribed listUnsubscribed + * * @return $this */ public function setListUnsubscribed($listUnsubscribed) @@ -399,7 +471,8 @@ public function setListUnsubscribed($listUnsubscribed) /** * Gets attributes - * @return map[string,string] + * + * @return object */ public function getAttributes() { @@ -408,7 +481,9 @@ public function getAttributes() /** * Sets attributes - * @param map[string,string] $attributes + * + * @param object $attributes Set of attributes of the contact + * * @return $this */ public function setAttributes($attributes) @@ -420,6 +495,7 @@ public function setAttributes($attributes) /** * Gets statistics + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatistics */ public function getStatistics() @@ -429,7 +505,9 @@ public function getStatistics() /** * Sets statistics - * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatistics $statistics + * + * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatistics $statistics statistics + * * @return $this */ public function setStatistics($statistics) @@ -440,7 +518,9 @@ public function setStatistics($statistics) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -450,7 +530,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -460,8 +542,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -475,7 +559,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -485,15 +571,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetailsStatistics.php b/lib/Model/GetExtendedContactDetailsStatistics.php index a1df14c1..19abe2c4 100644 --- a/lib/Model/GetExtendedContactDetailsStatistics.php +++ b/lib/Model/GetExtendedContactDetailsStatistics.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetailsStatistics Class Doc Comment * - * @category Class + * @category Class * @description Campaign statistics of the contact - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetailsStatistics implements ArrayAccess +class GetExtendedContactDetailsStatistics implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails_statistics'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -67,6 +70,7 @@ class GetExtendedContactDetailsStatistics implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -80,18 +84,30 @@ class GetExtendedContactDetailsStatistics implements ArrayAccess 'transacAttributes' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -105,9 +121,9 @@ public static function swaggerFormats() 'transacAttributes' => 'transacAttributes' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -121,9 +137,9 @@ public static function swaggerFormats() 'transacAttributes' => 'setTransacAttributes' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -137,34 +153,63 @@ public static function swaggerFormats() 'transacAttributes' => 'getTransacAttributes' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -179,19 +224,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -205,6 +250,7 @@ public function valid() /** * Gets messagesSent + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getMessagesSent() @@ -214,7 +260,9 @@ public function getMessagesSent() /** * Sets messagesSent + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $messagesSent Listing of the sent campaign for the contact + * * @return $this */ public function setMessagesSent($messagesSent) @@ -226,6 +274,7 @@ public function setMessagesSent($messagesSent) /** * Gets hardBounces + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getHardBounces() @@ -235,7 +284,9 @@ public function getHardBounces() /** * Sets hardBounces + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $hardBounces Listing of the hardbounes generated by the contact + * * @return $this */ public function setHardBounces($hardBounces) @@ -247,6 +298,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getSoftBounces() @@ -256,7 +308,9 @@ public function getSoftBounces() /** * Sets softBounces + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $softBounces Listing of the softbounes generated by the contact + * * @return $this */ public function setSoftBounces($softBounces) @@ -268,6 +322,7 @@ public function setSoftBounces($softBounces) /** * Gets complaints + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] */ public function getComplaints() @@ -277,7 +332,9 @@ public function getComplaints() /** * Sets complaints + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsMessagesSent[] $complaints Listing of the complaints generated by the contact + * * @return $this */ public function setComplaints($complaints) @@ -289,6 +346,7 @@ public function setComplaints($complaints) /** * Gets unsubscriptions + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptions */ public function getUnsubscriptions() @@ -298,7 +356,9 @@ public function getUnsubscriptions() /** * Sets unsubscriptions - * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptions $unsubscriptions + * + * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptions $unsubscriptions unsubscriptions + * * @return $this */ public function setUnsubscriptions($unsubscriptions) @@ -310,6 +370,7 @@ public function setUnsubscriptions($unsubscriptions) /** * Gets opened + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsOpened[] */ public function getOpened() @@ -319,7 +380,9 @@ public function getOpened() /** * Sets opened + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsOpened[] $opened Listing of the openings generated by the contact + * * @return $this */ public function setOpened($opened) @@ -331,6 +394,7 @@ public function setOpened($opened) /** * Gets clicked + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsClicked[] */ public function getClicked() @@ -340,7 +404,9 @@ public function getClicked() /** * Sets clicked + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsClicked[] $clicked Listing of the clicks generated by the contact + * * @return $this */ public function setClicked($clicked) @@ -352,6 +418,7 @@ public function setClicked($clicked) /** * Gets transacAttributes + * * @return object[] */ public function getTransacAttributes() @@ -361,7 +428,9 @@ public function getTransacAttributes() /** * Sets transacAttributes + * * @param object[] $transacAttributes Listing of the transactional attributes for the contact + * * @return $this */ public function setTransacAttributes($transacAttributes) @@ -372,7 +441,9 @@ public function setTransacAttributes($transacAttributes) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -382,7 +453,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -392,8 +465,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -407,7 +482,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -417,15 +494,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetailsStatisticsClicked.php b/lib/Model/GetExtendedContactDetailsStatisticsClicked.php index 707c56d5..e328d3ff 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsClicked.php +++ b/lib/Model/GetExtendedContactDetailsStatisticsClicked.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetailsStatisticsClicked Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetailsStatisticsClicked implements ArrayAccess +class GetExtendedContactDetailsStatisticsClicked implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails_statistics_clicked'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetExtendedContactDetailsStatisticsClicked implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetExtendedContactDetailsStatisticsClicked implements ArrayAccess 'links' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'links' => 'links' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'links' => 'setLinks' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'links' => 'getLinks' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['campaignId'] === null) { - $invalid_properties[] = "'campaignId' can't be null"; + $invalidProperties[] = "'campaignId' can't be null"; } if ($this->container['links'] === null) { - $invalid_properties[] = "'links' can't be null"; + $invalidProperties[] = "'links' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets campaignId + * * @return int */ public function getCampaignId() @@ -189,7 +235,9 @@ public function getCampaignId() /** * Sets campaignId + * * @param int $campaignId ID of the campaign which generated the event + * * @return $this */ public function setCampaignId($campaignId) @@ -201,6 +249,7 @@ public function setCampaignId($campaignId) /** * Gets links + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsLinks[] */ public function getLinks() @@ -210,7 +259,9 @@ public function getLinks() /** * Sets links + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsLinks[] $links Listing of the clicked links for the campaign + * * @return $this */ public function setLinks($links) @@ -221,7 +272,9 @@ public function setLinks($links) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetailsStatisticsLinks.php b/lib/Model/GetExtendedContactDetailsStatisticsLinks.php index 00c77adb..32fc9e25 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsLinks.php +++ b/lib/Model/GetExtendedContactDetailsStatisticsLinks.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetailsStatisticsLinks Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetailsStatisticsLinks implements ArrayAccess +class GetExtendedContactDetailsStatisticsLinks implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails_statistics_links'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetExtendedContactDetailsStatisticsLinks implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class GetExtendedContactDetailsStatisticsLinks implements ArrayAccess 'url' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'url' => 'url' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'url' => 'setUrl' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,34 +132,63 @@ public static function swaggerFormats() 'url' => 'getUrl' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -154,31 +199,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } if ($this->container['eventTime'] === null) { - $invalid_properties[] = "'eventTime' can't be null"; + $invalidProperties[] = "'eventTime' can't be null"; } if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } if ($this->container['url'] === null) { - $invalid_properties[] = "'url' can't be null"; + $invalidProperties[] = "'url' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -204,6 +249,7 @@ public function valid() /** * Gets count + * * @return int */ public function getCount() @@ -213,7 +259,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of clicks on this link for the campaign + * * @return $this */ public function setCount($count) @@ -225,6 +273,7 @@ public function setCount($count) /** * Gets eventTime + * * @return \DateTime */ public function getEventTime() @@ -234,7 +283,9 @@ public function getEventTime() /** * Sets eventTime + * * @param \DateTime $eventTime UTC date-time of the event + * * @return $this */ public function setEventTime($eventTime) @@ -246,6 +297,7 @@ public function setEventTime($eventTime) /** * Gets ip + * * @return string */ public function getIp() @@ -255,7 +307,9 @@ public function getIp() /** * Sets ip + * * @param string $ip IP from which the user has clicked on the link + * * @return $this */ public function setIp($ip) @@ -267,6 +321,7 @@ public function setIp($ip) /** * Gets url + * * @return string */ public function getUrl() @@ -276,7 +331,9 @@ public function getUrl() /** * Sets url + * * @param string $url URL of the clicked link + * * @return $this */ public function setUrl($url) @@ -287,7 +344,9 @@ public function setUrl($url) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -297,7 +356,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -307,8 +368,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -322,7 +385,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -332,15 +397,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetailsStatisticsMessagesSent.php b/lib/Model/GetExtendedContactDetailsStatisticsMessagesSent.php index 37c1e693..608fd98a 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsMessagesSent.php +++ b/lib/Model/GetExtendedContactDetailsStatisticsMessagesSent.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetailsStatisticsMessagesSent Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetailsStatisticsMessagesSent implements ArrayAccess +class GetExtendedContactDetailsStatisticsMessagesSent implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails_statistics_messagesSent'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetExtendedContactDetailsStatisticsMessagesSent implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetExtendedContactDetailsStatisticsMessagesSent implements ArrayAccess 'eventTime' => 'date-time' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'eventTime' => 'eventTime' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'eventTime' => 'setEventTime' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'eventTime' => 'getEventTime' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['campaignId'] === null) { - $invalid_properties[] = "'campaignId' can't be null"; + $invalidProperties[] = "'campaignId' can't be null"; } if ($this->container['eventTime'] === null) { - $invalid_properties[] = "'eventTime' can't be null"; + $invalidProperties[] = "'eventTime' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets campaignId + * * @return int */ public function getCampaignId() @@ -189,7 +235,9 @@ public function getCampaignId() /** * Sets campaignId + * * @param int $campaignId ID of the campaign which generated the event + * * @return $this */ public function setCampaignId($campaignId) @@ -201,6 +249,7 @@ public function setCampaignId($campaignId) /** * Gets eventTime + * * @return \DateTime */ public function getEventTime() @@ -210,7 +259,9 @@ public function getEventTime() /** * Sets eventTime + * * @param \DateTime $eventTime UTC date-time of the event + * * @return $this */ public function setEventTime($eventTime) @@ -221,7 +272,9 @@ public function setEventTime($eventTime) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetailsStatisticsOpened.php b/lib/Model/GetExtendedContactDetailsStatisticsOpened.php index 56cb4cfb..eedb44da 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsOpened.php +++ b/lib/Model/GetExtendedContactDetailsStatisticsOpened.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetailsStatisticsOpened Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetailsStatisticsOpened implements ArrayAccess +class GetExtendedContactDetailsStatisticsOpened implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails_statistics_opened'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetExtendedContactDetailsStatisticsOpened implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class GetExtendedContactDetailsStatisticsOpened implements ArrayAccess 'ip' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'ip' => 'ip' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'ip' => 'setIp' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,34 +132,63 @@ public static function swaggerFormats() 'ip' => 'getIp' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -154,31 +199,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['campaignId'] === null) { - $invalid_properties[] = "'campaignId' can't be null"; + $invalidProperties[] = "'campaignId' can't be null"; } if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } if ($this->container['eventTime'] === null) { - $invalid_properties[] = "'eventTime' can't be null"; + $invalidProperties[] = "'eventTime' can't be null"; } if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -204,6 +249,7 @@ public function valid() /** * Gets campaignId + * * @return int */ public function getCampaignId() @@ -213,7 +259,9 @@ public function getCampaignId() /** * Sets campaignId + * * @param int $campaignId ID of the campaign which generated the event + * * @return $this */ public function setCampaignId($campaignId) @@ -225,6 +273,7 @@ public function setCampaignId($campaignId) /** * Gets count + * * @return int */ public function getCount() @@ -234,7 +283,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of openings for the campaign + * * @return $this */ public function setCount($count) @@ -246,6 +297,7 @@ public function setCount($count) /** * Gets eventTime + * * @return \DateTime */ public function getEventTime() @@ -255,7 +307,9 @@ public function getEventTime() /** * Sets eventTime + * * @param \DateTime $eventTime UTC date-time of the event + * * @return $this */ public function setEventTime($eventTime) @@ -267,6 +321,7 @@ public function setEventTime($eventTime) /** * Gets ip + * * @return string */ public function getIp() @@ -276,7 +331,9 @@ public function getIp() /** * Sets ip + * * @param string $ip IP from which the user has opened the email + * * @return $this */ public function setIp($ip) @@ -287,7 +344,9 @@ public function setIp($ip) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -297,7 +356,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -307,8 +368,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -322,7 +385,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -332,15 +397,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.php b/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.php index b00fc3ae..7b4d1710 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.php +++ b/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptions.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetailsStatisticsUnsubscriptions Class Doc Comment * - * @category Class + * @category Class * @description Listing of the unsubscription for the contact - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetailsStatisticsUnsubscriptions implements ArrayAccess +class GetExtendedContactDetailsStatisticsUnsubscriptions implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails_statistics_unsubscriptions'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class GetExtendedContactDetailsStatisticsUnsubscriptions implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -68,18 +72,30 @@ class GetExtendedContactDetailsStatisticsUnsubscriptions implements ArrayAccess 'adminUnsubscription' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -87,9 +103,9 @@ public static function swaggerFormats() 'adminUnsubscription' => 'adminUnsubscription' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -97,9 +113,9 @@ public static function swaggerFormats() 'adminUnsubscription' => 'setAdminUnsubscription' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -107,34 +123,63 @@ public static function swaggerFormats() 'adminUnsubscription' => 'getAdminUnsubscription' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -143,25 +188,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['userUnsubscription'] === null) { - $invalid_properties[] = "'userUnsubscription' can't be null"; + $invalidProperties[] = "'userUnsubscription' can't be null"; } if ($this->container['adminUnsubscription'] === null) { - $invalid_properties[] = "'adminUnsubscription' can't be null"; + $invalidProperties[] = "'adminUnsubscription' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -181,6 +226,7 @@ public function valid() /** * Gets userUnsubscription + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] */ public function getUserUnsubscription() @@ -190,7 +236,9 @@ public function getUserUnsubscription() /** * Sets userUnsubscription + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription[] $userUnsubscription Contact unsubscribe via unsubscription link in a campaign + * * @return $this */ public function setUserUnsubscription($userUnsubscription) @@ -202,6 +250,7 @@ public function setUserUnsubscription($userUnsubscription) /** * Gets adminUnsubscription + * * @return \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] */ public function getAdminUnsubscription() @@ -211,7 +260,9 @@ public function getAdminUnsubscription() /** * Sets adminUnsubscription + * * @param \SendinBlue\Client\Model\GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription[] $adminUnsubscription Contact has been unsubscribed from the administrator + * * @return $this */ public function setAdminUnsubscription($adminUnsubscription) @@ -222,7 +273,9 @@ public function setAdminUnsubscription($adminUnsubscription) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -232,7 +285,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -242,8 +297,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -257,7 +314,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -267,15 +326,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php b/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php index 1ecaaf4b..604fdff2 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php +++ b/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription implements ArrayAccess +class GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails_statistics_unsubscriptions_adminUnsubscription'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription impl /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetExtendedContactDetailsStatisticsUnsubscriptionsAdminUnsubscription impl 'ip' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'ip' => 'ip' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'ip' => 'setIp' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'ip' => 'getIp' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['eventTime'] === null) { - $invalid_properties[] = "'eventTime' can't be null"; + $invalidProperties[] = "'eventTime' can't be null"; } if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets eventTime + * * @return \DateTime */ public function getEventTime() @@ -189,7 +235,9 @@ public function getEventTime() /** * Sets eventTime + * * @param \DateTime $eventTime UTC date-time of the event + * * @return $this */ public function setEventTime($eventTime) @@ -201,6 +249,7 @@ public function setEventTime($eventTime) /** * Gets ip + * * @return string */ public function getIp() @@ -210,7 +259,9 @@ public function getIp() /** * Sets ip + * * @param string $ip IP from which the user has been unsubscribed + * * @return $this */ public function setIp($ip) @@ -221,7 +272,9 @@ public function setIp($ip) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php b/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php index c71c2c9f..5bb6af18 100644 --- a/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php +++ b/lib/Model/GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription implements ArrayAccess +class GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedContactDetails_statistics_unsubscriptions_userUnsubscription'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription imple /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class GetExtendedContactDetailsStatisticsUnsubscriptionsUserUnsubscription imple 'ip' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'ip' => 'ip' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'ip' => 'setIp' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'ip' => 'getIp' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,28 +193,28 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['campaignId'] === null) { - $invalid_properties[] = "'campaignId' can't be null"; + $invalidProperties[] = "'campaignId' can't be null"; } if ($this->container['eventTime'] === null) { - $invalid_properties[] = "'eventTime' can't be null"; + $invalidProperties[] = "'eventTime' can't be null"; } if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -192,6 +237,7 @@ public function valid() /** * Gets campaignId + * * @return int */ public function getCampaignId() @@ -201,7 +247,9 @@ public function getCampaignId() /** * Sets campaignId + * * @param int $campaignId ID of the campaign which generated the event + * * @return $this */ public function setCampaignId($campaignId) @@ -213,6 +261,7 @@ public function setCampaignId($campaignId) /** * Gets eventTime + * * @return \DateTime */ public function getEventTime() @@ -222,7 +271,9 @@ public function getEventTime() /** * Sets eventTime + * * @param \DateTime $eventTime UTC date-time of the event + * * @return $this */ public function setEventTime($eventTime) @@ -234,6 +285,7 @@ public function setEventTime($eventTime) /** * Gets ip + * * @return string */ public function getIp() @@ -243,7 +295,9 @@ public function getIp() /** * Sets ip + * * @param string $ip IP from which the user has unsubscribed + * * @return $this */ public function setIp($ip) @@ -254,7 +308,9 @@ public function setIp($ip) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -264,7 +320,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -274,8 +332,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -289,7 +349,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -299,15 +361,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedList.php b/lib/Model/GetExtendedList.php index 0892d5c4..75861cb9 100644 --- a/lib/Model/GetExtendedList.php +++ b/lib/Model/GetExtendedList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedList implements ArrayAccess +class GetExtendedList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -66,6 +69,7 @@ class GetExtendedList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -79,18 +83,30 @@ class GetExtendedList implements ArrayAccess 'dynamicList' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'dynamicList' => 'dynamicList' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -120,9 +136,9 @@ public static function swaggerFormats() 'dynamicList' => 'setDynamicList' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -136,34 +152,63 @@ public static function swaggerFormats() 'dynamicList' => 'getDynamicList' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -178,37 +223,37 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['totalBlacklisted'] === null) { - $invalid_properties[] = "'totalBlacklisted' can't be null"; + $invalidProperties[] = "'totalBlacklisted' can't be null"; } if ($this->container['totalSubscribers'] === null) { - $invalid_properties[] = "'totalSubscribers' can't be null"; + $invalidProperties[] = "'totalSubscribers' can't be null"; } if ($this->container['folderId'] === null) { - $invalid_properties[] = "'folderId' can't be null"; + $invalidProperties[] = "'folderId' can't be null"; } if ($this->container['createdAt'] === null) { - $invalid_properties[] = "'createdAt' can't be null"; + $invalidProperties[] = "'createdAt' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -240,6 +285,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -249,7 +295,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the list + * * @return $this */ public function setId($id) @@ -261,6 +309,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -270,7 +319,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the list + * * @return $this */ public function setName($name) @@ -282,6 +333,7 @@ public function setName($name) /** * Gets totalBlacklisted + * * @return int */ public function getTotalBlacklisted() @@ -291,7 +343,9 @@ public function getTotalBlacklisted() /** * Sets totalBlacklisted + * * @param int $totalBlacklisted Number of blacklisted contacts in the list + * * @return $this */ public function setTotalBlacklisted($totalBlacklisted) @@ -303,6 +357,7 @@ public function setTotalBlacklisted($totalBlacklisted) /** * Gets totalSubscribers + * * @return int */ public function getTotalSubscribers() @@ -312,7 +367,9 @@ public function getTotalSubscribers() /** * Sets totalSubscribers + * * @param int $totalSubscribers Number of contacts in the list + * * @return $this */ public function setTotalSubscribers($totalSubscribers) @@ -324,6 +381,7 @@ public function setTotalSubscribers($totalSubscribers) /** * Gets folderId + * * @return int */ public function getFolderId() @@ -333,7 +391,9 @@ public function getFolderId() /** * Sets folderId + * * @param int $folderId ID of the folder + * * @return $this */ public function setFolderId($folderId) @@ -345,6 +405,7 @@ public function setFolderId($folderId) /** * Gets createdAt + * * @return \DateTime */ public function getCreatedAt() @@ -354,7 +415,9 @@ public function getCreatedAt() /** * Sets createdAt + * * @param \DateTime $createdAt Creation UTC date-time of the list (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setCreatedAt($createdAt) @@ -366,6 +429,7 @@ public function setCreatedAt($createdAt) /** * Gets campaignStats + * * @return \SendinBlue\Client\Model\GetExtendedListCampaignStats[] */ public function getCampaignStats() @@ -375,7 +439,9 @@ public function getCampaignStats() /** * Sets campaignStats - * @param \SendinBlue\Client\Model\GetExtendedListCampaignStats[] $campaignStats + * + * @param \SendinBlue\Client\Model\GetExtendedListCampaignStats[] $campaignStats campaignStats + * * @return $this */ public function setCampaignStats($campaignStats) @@ -387,6 +453,7 @@ public function setCampaignStats($campaignStats) /** * Gets dynamicList + * * @return bool */ public function getDynamicList() @@ -396,7 +463,9 @@ public function getDynamicList() /** * Sets dynamicList + * * @param bool $dynamicList Status telling if the list is dynamic or not (true=dynamic, false=not dynamic) + * * @return $this */ public function setDynamicList($dynamicList) @@ -407,7 +476,9 @@ public function setDynamicList($dynamicList) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -417,7 +488,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -427,8 +500,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -442,7 +517,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -452,15 +529,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetExtendedListCampaignStats.php b/lib/Model/GetExtendedListCampaignStats.php index 24b55a9c..90143a22 100644 --- a/lib/Model/GetExtendedListCampaignStats.php +++ b/lib/Model/GetExtendedListCampaignStats.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetExtendedListCampaignStats Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetExtendedListCampaignStats implements ArrayAccess +class GetExtendedListCampaignStats implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getExtendedList_campaignStats'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetExtendedListCampaignStats implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetExtendedListCampaignStats implements ArrayAccess 'stats' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'stats' => 'stats' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'stats' => 'setStats' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'stats' => 'getStats' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['campaignId'] === null) { - $invalid_properties[] = "'campaignId' can't be null"; + $invalidProperties[] = "'campaignId' can't be null"; } if ($this->container['stats'] === null) { - $invalid_properties[] = "'stats' can't be null"; + $invalidProperties[] = "'stats' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets campaignId + * * @return int */ public function getCampaignId() @@ -189,7 +235,9 @@ public function getCampaignId() /** * Sets campaignId + * * @param int $campaignId ID of the campaign + * * @return $this */ public function setCampaignId($campaignId) @@ -201,6 +249,7 @@ public function setCampaignId($campaignId) /** * Gets stats + * * @return \SendinBlue\Client\Model\GetCampaignStats */ public function getStats() @@ -210,7 +259,9 @@ public function getStats() /** * Sets stats - * @param \SendinBlue\Client\Model\GetCampaignStats $stats + * + * @param \SendinBlue\Client\Model\GetCampaignStats $stats stats + * * @return $this */ public function setStats($stats) @@ -221,7 +272,9 @@ public function setStats($stats) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetFolder.php b/lib/Model/GetFolder.php index fb0208a0..bf3d2a8c 100644 --- a/lib/Model/GetFolder.php +++ b/lib/Model/GetFolder.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetFolder Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetFolder implements ArrayAccess +class GetFolder implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getFolder'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class GetFolder implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class GetFolder implements ArrayAccess 'uniqueSubscribers' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'uniqueSubscribers' => 'uniqueSubscribers' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'uniqueSubscribers' => 'setUniqueSubscribers' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,34 +137,63 @@ public static function swaggerFormats() 'uniqueSubscribers' => 'getUniqueSubscribers' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -160,34 +205,34 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['totalBlacklisted'] === null) { - $invalid_properties[] = "'totalBlacklisted' can't be null"; + $invalidProperties[] = "'totalBlacklisted' can't be null"; } if ($this->container['totalSubscribers'] === null) { - $invalid_properties[] = "'totalSubscribers' can't be null"; + $invalidProperties[] = "'totalSubscribers' can't be null"; } if ($this->container['uniqueSubscribers'] === null) { - $invalid_properties[] = "'uniqueSubscribers' can't be null"; + $invalidProperties[] = "'uniqueSubscribers' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -216,6 +261,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -225,7 +271,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the folder + * * @return $this */ public function setId($id) @@ -237,6 +285,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -246,7 +295,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the folder + * * @return $this */ public function setName($name) @@ -258,6 +309,7 @@ public function setName($name) /** * Gets totalBlacklisted + * * @return int */ public function getTotalBlacklisted() @@ -267,7 +319,9 @@ public function getTotalBlacklisted() /** * Sets totalBlacklisted + * * @param int $totalBlacklisted Number of blacklisted contacts in the folder + * * @return $this */ public function setTotalBlacklisted($totalBlacklisted) @@ -279,6 +333,7 @@ public function setTotalBlacklisted($totalBlacklisted) /** * Gets totalSubscribers + * * @return int */ public function getTotalSubscribers() @@ -288,7 +343,9 @@ public function getTotalSubscribers() /** * Sets totalSubscribers + * * @param int $totalSubscribers Number of contacts in the folder + * * @return $this */ public function setTotalSubscribers($totalSubscribers) @@ -300,6 +357,7 @@ public function setTotalSubscribers($totalSubscribers) /** * Gets uniqueSubscribers + * * @return int */ public function getUniqueSubscribers() @@ -309,7 +367,9 @@ public function getUniqueSubscribers() /** * Sets uniqueSubscribers + * * @param int $uniqueSubscribers Number of unique contacts in the folder + * * @return $this */ public function setUniqueSubscribers($uniqueSubscribers) @@ -320,7 +380,9 @@ public function setUniqueSubscribers($uniqueSubscribers) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -330,7 +392,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -340,8 +404,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -355,7 +421,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -365,15 +433,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetFolderLists.php b/lib/Model/GetFolderLists.php index 00f57e72..b8b6da27 100644 --- a/lib/Model/GetFolderLists.php +++ b/lib/Model/GetFolderLists.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetFolderLists Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetFolderLists implements ArrayAccess +class GetFolderLists implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getFolderLists'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetFolderLists implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetFolderLists implements ArrayAccess 'count' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'count' => 'count' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'count' => 'setCount' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'count' => 'getCount' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['lists'] === null) { - $invalid_properties[] = "'lists' can't be null"; + $invalidProperties[] = "'lists' can't be null"; } if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets lists + * * @return object[] */ public function getLists() @@ -189,7 +235,9 @@ public function getLists() /** * Sets lists - * @param object[] $lists + * + * @param object[] $lists lists + * * @return $this */ public function setLists($lists) @@ -201,6 +249,7 @@ public function setLists($lists) /** * Gets count + * * @return int */ public function getCount() @@ -210,7 +259,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of lists in the folder + * * @return $this */ public function setCount($count) @@ -221,7 +272,9 @@ public function setCount($count) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetFolders.php b/lib/Model/GetFolders.php index 6ab4c3f6..095d19aa 100644 --- a/lib/Model/GetFolders.php +++ b/lib/Model/GetFolders.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetFolders Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetFolders implements ArrayAccess +class GetFolders implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getFolders'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetFolders implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetFolders implements ArrayAccess 'count' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'count' => 'count' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'count' => 'setCount' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'count' => 'getCount' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets folders + * * @return object[] */ public function getFolders() @@ -177,7 +223,9 @@ public function getFolders() /** * Sets folders - * @param object[] $folders + * + * @param object[] $folders folders + * * @return $this */ public function setFolders($folders) @@ -189,6 +237,7 @@ public function setFolders($folders) /** * Gets count + * * @return int */ public function getCount() @@ -198,7 +247,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of folders available in your account + * * @return $this */ public function setCount($count) @@ -209,7 +260,9 @@ public function setCount($count) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetIp.php b/lib/Model/GetIp.php index f873e631..027a39ef 100644 --- a/lib/Model/GetIp.php +++ b/lib/Model/GetIp.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetIp Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetIp implements ArrayAccess +class GetIp implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getIp'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetIp implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class GetIp implements ArrayAccess 'domain' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'domain' => 'domain' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'domain' => 'setDomain' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,34 +132,63 @@ public static function swaggerFormats() 'domain' => 'getDomain' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -154,31 +199,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } if ($this->container['active'] === null) { - $invalid_properties[] = "'active' can't be null"; + $invalidProperties[] = "'active' can't be null"; } if ($this->container['domain'] === null) { - $invalid_properties[] = "'domain' can't be null"; + $invalidProperties[] = "'domain' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -204,6 +249,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -213,7 +259,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the dedicated IP + * * @return $this */ public function setId($id) @@ -225,6 +273,7 @@ public function setId($id) /** * Gets ip + * * @return string */ public function getIp() @@ -234,7 +283,9 @@ public function getIp() /** * Sets ip + * * @param string $ip Dedicated IP + * * @return $this */ public function setIp($ip) @@ -246,6 +297,7 @@ public function setIp($ip) /** * Gets active + * * @return bool */ public function getActive() @@ -255,7 +307,9 @@ public function getActive() /** * Sets active + * * @param bool $active Status of the IP (true=active, false=inactive) + * * @return $this */ public function setActive($active) @@ -267,6 +321,7 @@ public function setActive($active) /** * Gets domain + * * @return string */ public function getDomain() @@ -276,7 +331,9 @@ public function getDomain() /** * Sets domain + * * @param string $domain Domain associated to the IP + * * @return $this */ public function setDomain($domain) @@ -287,7 +344,9 @@ public function setDomain($domain) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -297,7 +356,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -307,8 +368,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -322,7 +385,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -332,15 +397,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetIpFromSender.php b/lib/Model/GetIpFromSender.php index 7a0a0fac..3c8e73cb 100644 --- a/lib/Model/GetIpFromSender.php +++ b/lib/Model/GetIpFromSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetIpFromSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetIpFromSender implements ArrayAccess +class GetIpFromSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getIpFromSender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetIpFromSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class GetIpFromSender implements ArrayAccess 'weight' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'weight' => 'weight' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'weight' => 'setWeight' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,34 +132,63 @@ public static function swaggerFormats() 'weight' => 'getWeight' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -154,31 +199,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } if ($this->container['domain'] === null) { - $invalid_properties[] = "'domain' can't be null"; + $invalidProperties[] = "'domain' can't be null"; } if ($this->container['weight'] === null) { - $invalid_properties[] = "'weight' can't be null"; + $invalidProperties[] = "'weight' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -204,6 +249,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -213,7 +259,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the dedicated IP + * * @return $this */ public function setId($id) @@ -225,6 +273,7 @@ public function setId($id) /** * Gets ip + * * @return string */ public function getIp() @@ -234,7 +283,9 @@ public function getIp() /** * Sets ip + * * @param string $ip Dedicated IP + * * @return $this */ public function setIp($ip) @@ -246,6 +297,7 @@ public function setIp($ip) /** * Gets domain + * * @return string */ public function getDomain() @@ -255,7 +307,9 @@ public function getDomain() /** * Sets domain + * * @param string $domain Domain associated to the IP + * * @return $this */ public function setDomain($domain) @@ -267,6 +321,7 @@ public function setDomain($domain) /** * Gets weight + * * @return int */ public function getWeight() @@ -276,7 +331,9 @@ public function getWeight() /** * Sets weight + * * @param int $weight Weight of the IP + * * @return $this */ public function setWeight($weight) @@ -287,7 +344,9 @@ public function setWeight($weight) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -297,7 +356,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -307,8 +368,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -322,7 +385,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -332,15 +397,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetIps.php b/lib/Model/GetIps.php index 9b687e47..eb660d20 100644 --- a/lib/Model/GetIps.php +++ b/lib/Model/GetIps.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetIps Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetIps implements ArrayAccess +class GetIps implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getIps'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetIps implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'ips' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'ips' => 'ips' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'ips' => 'setIps' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'ips' => 'getIps' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['ips'] === null) { - $invalid_properties[] = "'ips' can't be null"; + $invalidProperties[] = "'ips' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets ips + * * @return \SendinBlue\Client\Model\GetIp[] */ public function getIps() @@ -177,7 +223,9 @@ public function getIps() /** * Sets ips + * * @param \SendinBlue\Client\Model\GetIp[] $ips Dedicated IP(s) available on your account + * * @return $this */ public function setIps($ips) @@ -188,7 +236,9 @@ public function setIps($ips) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetIpsFromSender.php b/lib/Model/GetIpsFromSender.php index ce83b766..c3026ec5 100644 --- a/lib/Model/GetIpsFromSender.php +++ b/lib/Model/GetIpsFromSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetIpsFromSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetIpsFromSender implements ArrayAccess +class GetIpsFromSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getIpsFromSender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetIpsFromSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'ips' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'ips' => 'ips' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'ips' => 'setIps' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'ips' => 'getIps' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['ips'] === null) { - $invalid_properties[] = "'ips' can't be null"; + $invalidProperties[] = "'ips' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets ips + * * @return \SendinBlue\Client\Model\GetIpFromSender[] */ public function getIps() @@ -177,7 +223,9 @@ public function getIps() /** * Sets ips + * * @param \SendinBlue\Client\Model\GetIpFromSender[] $ips Dedicated IP(s) linked to a sender + * * @return $this */ public function setIps($ips) @@ -188,7 +236,9 @@ public function setIps($ips) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetList.php b/lib/Model/GetList.php index f760f728..74c5183f 100644 --- a/lib/Model/GetList.php +++ b/lib/Model/GetList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetList implements ArrayAccess +class GetList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class GetList implements ArrayAccess 'totalSubscribers' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'totalSubscribers' => 'totalSubscribers' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'totalSubscribers' => 'setTotalSubscribers' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,34 +132,63 @@ public static function swaggerFormats() 'totalSubscribers' => 'getTotalSubscribers' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -154,31 +199,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['totalBlacklisted'] === null) { - $invalid_properties[] = "'totalBlacklisted' can't be null"; + $invalidProperties[] = "'totalBlacklisted' can't be null"; } if ($this->container['totalSubscribers'] === null) { - $invalid_properties[] = "'totalSubscribers' can't be null"; + $invalidProperties[] = "'totalSubscribers' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -204,6 +249,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -213,7 +259,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the list + * * @return $this */ public function setId($id) @@ -225,6 +273,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -234,7 +283,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the list + * * @return $this */ public function setName($name) @@ -246,6 +297,7 @@ public function setName($name) /** * Gets totalBlacklisted + * * @return int */ public function getTotalBlacklisted() @@ -255,7 +307,9 @@ public function getTotalBlacklisted() /** * Sets totalBlacklisted + * * @param int $totalBlacklisted Number of blacklisted contacts in the list + * * @return $this */ public function setTotalBlacklisted($totalBlacklisted) @@ -267,6 +321,7 @@ public function setTotalBlacklisted($totalBlacklisted) /** * Gets totalSubscribers + * * @return int */ public function getTotalSubscribers() @@ -276,7 +331,9 @@ public function getTotalSubscribers() /** * Sets totalSubscribers + * * @param int $totalSubscribers Number of contacts in the list + * * @return $this */ public function setTotalSubscribers($totalSubscribers) @@ -287,7 +344,9 @@ public function setTotalSubscribers($totalSubscribers) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -297,7 +356,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -307,8 +368,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -322,7 +385,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -332,15 +397,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetLists.php b/lib/Model/GetLists.php index 5546e8c6..b0041937 100644 --- a/lib/Model/GetLists.php +++ b/lib/Model/GetLists.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetLists Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetLists implements ArrayAccess +class GetLists implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getLists'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetLists implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetLists implements ArrayAccess 'count' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'count' => 'count' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'count' => 'setCount' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'count' => 'getCount' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['lists'] === null) { - $invalid_properties[] = "'lists' can't be null"; + $invalidProperties[] = "'lists' can't be null"; } if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets lists + * * @return object[] */ public function getLists() @@ -189,7 +235,9 @@ public function getLists() /** * Sets lists + * * @param object[] $lists Listing of all the lists available in your account + * * @return $this */ public function setLists($lists) @@ -201,6 +249,7 @@ public function setLists($lists) /** * Gets count + * * @return int */ public function getCount() @@ -210,7 +259,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of lists in your account + * * @return $this */ public function setCount($count) @@ -221,7 +272,9 @@ public function setCount($count) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetProcess.php b/lib/Model/GetProcess.php index a2fec915..4e90a364 100644 --- a/lib/Model/GetProcess.php +++ b/lib/Model/GetProcess.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetProcess Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetProcess implements ArrayAccess +class GetProcess implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getProcess'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class GetProcess implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class GetProcess implements ArrayAccess 'exportUrl' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'exportUrl' => 'export_url' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'exportUrl' => 'setExportUrl' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,21 +132,47 @@ public static function swaggerFormats() 'exportUrl' => 'getExportUrl' ]; + /** + * 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 STATUS_QUEUED = 'queued'; const STATUS_IN_PROCESS = 'in_process'; const STATUS_COMPLETED = 'completed'; @@ -139,6 +181,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getStatusAllowableValues() @@ -153,13 +196,16 @@ public function getStatusAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -170,36 +216,36 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['status'] === null) { - $invalid_properties[] = "'status' can't be null"; + $invalidProperties[] = "'status' can't be null"; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -213,8 +259,8 @@ public function valid() if ($this->container['status'] === null) { return false; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { return false; } if ($this->container['name'] === null) { @@ -226,6 +272,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -235,7 +282,9 @@ public function getId() /** * Sets id + * * @param int $id Id of the process + * * @return $this */ public function setId($id) @@ -247,6 +296,7 @@ public function setId($id) /** * Gets status + * * @return string */ public function getStatus() @@ -256,17 +306,19 @@ public function getStatus() /** * Sets status + * * @param string $status Status of the process + * * @return $this */ public function setStatus($status) { - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($status, $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -277,6 +329,7 @@ public function setStatus($status) /** * Gets name + * * @return string */ public function getName() @@ -286,7 +339,9 @@ public function getName() /** * Sets name + * * @param string $name Process name + * * @return $this */ public function setName($name) @@ -298,6 +353,7 @@ public function setName($name) /** * Gets exportUrl + * * @return string */ public function getExportUrl() @@ -307,7 +363,9 @@ public function getExportUrl() /** * Sets exportUrl + * * @param string $exportUrl URL on which send export the of contacts once the process is completed + * * @return $this */ public function setExportUrl($exportUrl) @@ -318,7 +376,9 @@ public function setExportUrl($exportUrl) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -328,7 +388,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -338,8 +400,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -353,7 +417,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -363,15 +429,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetProcesses.php b/lib/Model/GetProcesses.php index ed660085..7f536394 100644 --- a/lib/Model/GetProcesses.php +++ b/lib/Model/GetProcesses.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetProcesses Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetProcesses implements ArrayAccess +class GetProcesses implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getProcesses'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetProcesses implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetProcesses implements ArrayAccess 'count' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'count' => 'count' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'count' => 'setCount' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'count' => 'getCount' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +187,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets processes + * * @return \SendinBlue\Client\Model\GetProcess[] */ public function getProcesses() @@ -183,7 +229,9 @@ public function getProcesses() /** * Sets processes + * * @param \SendinBlue\Client\Model\GetProcess[] $processes List of processes available on your account + * * @return $this */ public function setProcesses($processes) @@ -195,6 +243,7 @@ public function setProcesses($processes) /** * Gets count + * * @return int */ public function getCount() @@ -204,7 +253,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of processes available on your account + * * @return $this */ public function setCount($count) @@ -215,7 +266,9 @@ public function setCount($count) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +278,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +307,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +319,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetReports.php b/lib/Model/GetReports.php index b4f76c05..05a6ebac 100644 --- a/lib/Model/GetReports.php +++ b/lib/Model/GetReports.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetReports Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetReports implements ArrayAccess +class GetReports implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getReports'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetReports implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'reports' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'reports' => 'reports' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'reports' => 'setReports' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'reports' => 'getReports' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets reports + * * @return \SendinBlue\Client\Model\GetReportsReports[] */ public function getReports() @@ -171,7 +217,9 @@ public function getReports() /** * Sets reports - * @param \SendinBlue\Client\Model\GetReportsReports[] $reports + * + * @param \SendinBlue\Client\Model\GetReportsReports[] $reports reports + * * @return $this */ public function setReports($reports) @@ -182,7 +230,9 @@ public function setReports($reports) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetReportsReports.php b/lib/Model/GetReportsReports.php index 69ee6fb4..6a9a2a04 100644 --- a/lib/Model/GetReportsReports.php +++ b/lib/Model/GetReportsReports.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetReportsReports Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetReportsReports implements ArrayAccess +class GetReportsReports implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getReports_reports'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -70,6 +73,7 @@ class GetReportsReports implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -87,18 +91,30 @@ class GetReportsReports implements ArrayAccess 'invalid' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -116,9 +132,9 @@ public static function swaggerFormats() 'invalid' => 'invalid' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -136,9 +152,9 @@ public static function swaggerFormats() 'invalid' => 'setInvalid' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -156,34 +172,63 @@ public static function swaggerFormats() 'invalid' => 'getInvalid' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -202,55 +247,55 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['date'] === null) { - $invalid_properties[] = "'date' can't be null"; + $invalidProperties[] = "'date' can't be null"; } if ($this->container['requests'] === null) { - $invalid_properties[] = "'requests' can't be null"; + $invalidProperties[] = "'requests' can't be null"; } if ($this->container['delivered'] === null) { - $invalid_properties[] = "'delivered' can't be null"; + $invalidProperties[] = "'delivered' can't be null"; } if ($this->container['hardBounces'] === null) { - $invalid_properties[] = "'hardBounces' can't be null"; + $invalidProperties[] = "'hardBounces' can't be null"; } if ($this->container['softBounces'] === null) { - $invalid_properties[] = "'softBounces' can't be null"; + $invalidProperties[] = "'softBounces' can't be null"; } if ($this->container['clicks'] === null) { - $invalid_properties[] = "'clicks' can't be null"; + $invalidProperties[] = "'clicks' can't be null"; } if ($this->container['uniqueClicks'] === null) { - $invalid_properties[] = "'uniqueClicks' can't be null"; + $invalidProperties[] = "'uniqueClicks' can't be null"; } if ($this->container['opens'] === null) { - $invalid_properties[] = "'opens' can't be null"; + $invalidProperties[] = "'opens' can't be null"; } if ($this->container['uniqueOpens'] === null) { - $invalid_properties[] = "'uniqueOpens' can't be null"; + $invalidProperties[] = "'uniqueOpens' can't be null"; } if ($this->container['spamReports'] === null) { - $invalid_properties[] = "'spamReports' can't be null"; + $invalidProperties[] = "'spamReports' can't be null"; } if ($this->container['blocked'] === null) { - $invalid_properties[] = "'blocked' can't be null"; + $invalidProperties[] = "'blocked' can't be null"; } if ($this->container['invalid'] === null) { - $invalid_properties[] = "'invalid' can't be null"; + $invalidProperties[] = "'invalid' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -300,6 +345,7 @@ public function valid() /** * Gets date + * * @return \DateTime */ public function getDate() @@ -309,7 +355,9 @@ public function getDate() /** * Sets date + * * @param \DateTime $date Date of the statistics + * * @return $this */ public function setDate($date) @@ -321,6 +369,7 @@ public function setDate($date) /** * Gets requests + * * @return int */ public function getRequests() @@ -330,7 +379,9 @@ public function getRequests() /** * Sets requests + * * @param int $requests Number of requests for the date + * * @return $this */ public function setRequests($requests) @@ -342,6 +393,7 @@ public function setRequests($requests) /** * Gets delivered + * * @return int */ public function getDelivered() @@ -351,7 +403,9 @@ public function getDelivered() /** * Sets delivered + * * @param int $delivered Number of delivered emails for the date + * * @return $this */ public function setDelivered($delivered) @@ -363,6 +417,7 @@ public function setDelivered($delivered) /** * Gets hardBounces + * * @return int */ public function getHardBounces() @@ -372,7 +427,9 @@ public function getHardBounces() /** * Sets hardBounces + * * @param int $hardBounces Number of hardbounces for the date + * * @return $this */ public function setHardBounces($hardBounces) @@ -384,6 +441,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces + * * @return int */ public function getSoftBounces() @@ -393,7 +451,9 @@ public function getSoftBounces() /** * Sets softBounces + * * @param int $softBounces Number of softbounces for the date + * * @return $this */ public function setSoftBounces($softBounces) @@ -405,6 +465,7 @@ public function setSoftBounces($softBounces) /** * Gets clicks + * * @return int */ public function getClicks() @@ -414,7 +475,9 @@ public function getClicks() /** * Sets clicks + * * @param int $clicks Number of clicks for the date + * * @return $this */ public function setClicks($clicks) @@ -426,6 +489,7 @@ public function setClicks($clicks) /** * Gets uniqueClicks + * * @return int */ public function getUniqueClicks() @@ -435,7 +499,9 @@ public function getUniqueClicks() /** * Sets uniqueClicks + * * @param int $uniqueClicks Number of unique clicks for the date + * * @return $this */ public function setUniqueClicks($uniqueClicks) @@ -447,6 +513,7 @@ public function setUniqueClicks($uniqueClicks) /** * Gets opens + * * @return int */ public function getOpens() @@ -456,7 +523,9 @@ public function getOpens() /** * Sets opens + * * @param int $opens Number of openings for the date + * * @return $this */ public function setOpens($opens) @@ -468,6 +537,7 @@ public function setOpens($opens) /** * Gets uniqueOpens + * * @return int */ public function getUniqueOpens() @@ -477,7 +547,9 @@ public function getUniqueOpens() /** * Sets uniqueOpens + * * @param int $uniqueOpens Number of unique openings for the date + * * @return $this */ public function setUniqueOpens($uniqueOpens) @@ -489,6 +561,7 @@ public function setUniqueOpens($uniqueOpens) /** * Gets spamReports + * * @return int */ public function getSpamReports() @@ -498,7 +571,9 @@ public function getSpamReports() /** * Sets spamReports + * * @param int $spamReports Number of complaints (spam reports) for the date + * * @return $this */ public function setSpamReports($spamReports) @@ -510,6 +585,7 @@ public function setSpamReports($spamReports) /** * Gets blocked + * * @return int */ public function getBlocked() @@ -519,7 +595,9 @@ public function getBlocked() /** * Sets blocked + * * @param int $blocked Number of blocked emails for the date + * * @return $this */ public function setBlocked($blocked) @@ -531,6 +609,7 @@ public function setBlocked($blocked) /** * Gets invalid + * * @return int */ public function getInvalid() @@ -540,7 +619,9 @@ public function getInvalid() /** * Sets invalid + * * @param int $invalid Number of invalid emails for the date + * * @return $this */ public function setInvalid($invalid) @@ -551,7 +632,9 @@ public function setInvalid($invalid) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -561,7 +644,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -571,8 +656,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -586,7 +673,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -596,15 +685,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSendersList.php b/lib/Model/GetSendersList.php index 8d373c58..7efcf132 100644 --- a/lib/Model/GetSendersList.php +++ b/lib/Model/GetSendersList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSendersList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSendersList implements ArrayAccess +class GetSendersList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSendersList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetSendersList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'senders' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'senders' => 'senders' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'senders' => 'setSenders' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'senders' => 'getSenders' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets senders + * * @return \SendinBlue\Client\Model\GetSendersListSenders[] */ public function getSenders() @@ -171,7 +217,9 @@ public function getSenders() /** * Sets senders + * * @param \SendinBlue\Client\Model\GetSendersListSenders[] $senders List of the senders available in your account + * * @return $this */ public function setSenders($senders) @@ -182,7 +230,9 @@ public function setSenders($senders) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSendersListIps.php b/lib/Model/GetSendersListIps.php index 536db95a..89bdbd6e 100644 --- a/lib/Model/GetSendersListIps.php +++ b/lib/Model/GetSendersListIps.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSendersListIps Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSendersListIps implements ArrayAccess +class GetSendersListIps implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSendersList_ips'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class GetSendersListIps implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class GetSendersListIps implements ArrayAccess 'weight' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'weight' => 'weight' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'weight' => 'setWeight' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'weight' => 'getWeight' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,28 +193,28 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['ip'] === null) { - $invalid_properties[] = "'ip' can't be null"; + $invalidProperties[] = "'ip' can't be null"; } if ($this->container['domain'] === null) { - $invalid_properties[] = "'domain' can't be null"; + $invalidProperties[] = "'domain' can't be null"; } if ($this->container['weight'] === null) { - $invalid_properties[] = "'weight' can't be null"; + $invalidProperties[] = "'weight' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -192,6 +237,7 @@ public function valid() /** * Gets ip + * * @return string */ public function getIp() @@ -201,7 +247,9 @@ public function getIp() /** * Sets ip + * * @param string $ip Dedicated IP available in your account + * * @return $this */ public function setIp($ip) @@ -213,6 +261,7 @@ public function setIp($ip) /** * Gets domain + * * @return string */ public function getDomain() @@ -222,7 +271,9 @@ public function getDomain() /** * Sets domain + * * @param string $domain Domain of the IP + * * @return $this */ public function setDomain($domain) @@ -234,6 +285,7 @@ public function setDomain($domain) /** * Gets weight + * * @return int */ public function getWeight() @@ -243,7 +295,9 @@ public function getWeight() /** * Sets weight + * * @param int $weight Weight of the IP for this sender + * * @return $this */ public function setWeight($weight) @@ -254,7 +308,9 @@ public function setWeight($weight) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -264,7 +320,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -274,8 +332,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -289,7 +349,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -299,15 +361,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSendersListSenders.php b/lib/Model/GetSendersListSenders.php index 6d561bfb..8fcd3a15 100644 --- a/lib/Model/GetSendersListSenders.php +++ b/lib/Model/GetSendersListSenders.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSendersListSenders Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSendersListSenders implements ArrayAccess +class GetSendersListSenders implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSendersList_senders'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class GetSendersListSenders implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class GetSendersListSenders implements ArrayAccess 'ips' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'ips' => 'ips' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'ips' => 'setIps' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,34 +137,63 @@ public static function swaggerFormats() 'ips' => 'getIps' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -160,31 +205,31 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } if ($this->container['active'] === null) { - $invalid_properties[] = "'active' can't be null"; + $invalidProperties[] = "'active' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -210,6 +255,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -219,7 +265,9 @@ public function getId() /** * Sets id + * * @param int $id Id of the sender + * * @return $this */ public function setId($id) @@ -231,6 +279,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -240,7 +289,9 @@ public function getName() /** * Sets name + * * @param string $name From Name associated to the sender + * * @return $this */ public function setName($name) @@ -252,6 +303,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -261,7 +313,9 @@ public function getEmail() /** * Sets email + * * @param string $email From Email associated to the sender + * * @return $this */ public function setEmail($email) @@ -273,6 +327,7 @@ public function setEmail($email) /** * Gets active + * * @return bool */ public function getActive() @@ -282,7 +337,9 @@ public function getActive() /** * Sets active + * * @param bool $active Status of sender (true=activated, false=deactivated) + * * @return $this */ public function setActive($active) @@ -294,6 +351,7 @@ public function setActive($active) /** * Gets ips + * * @return \SendinBlue\Client\Model\GetSendersListIps[] */ public function getIps() @@ -303,7 +361,9 @@ public function getIps() /** * Sets ips + * * @param \SendinBlue\Client\Model\GetSendersListIps[] $ips List of dedicated IP(s) available in the account. This data is displayed only for dedicated IPs + * * @return $this */ public function setIps($ips) @@ -314,7 +374,9 @@ public function setIps($ips) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -324,7 +386,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -334,8 +398,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -349,7 +415,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -359,15 +427,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmsCampaign.php b/lib/Model/GetSmsCampaign.php index 80c33fd8..219ba61a 100644 --- a/lib/Model/GetSmsCampaign.php +++ b/lib/Model/GetSmsCampaign.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmsCampaign Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmsCampaign implements ArrayAccess +class GetSmsCampaign implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmsCampaign'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -69,6 +72,7 @@ class GetSmsCampaign implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -85,18 +89,30 @@ class GetSmsCampaign implements ArrayAccess 'statistics' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -113,9 +129,9 @@ public static function swaggerFormats() 'statistics' => 'statistics' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -132,9 +148,9 @@ public static function swaggerFormats() 'statistics' => 'setStatistics' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -151,21 +167,47 @@ public static function swaggerFormats() 'statistics' => 'getStatistics' ]; + /** + * 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 STATUS_DRAFT = 'draft'; const STATUS_SENT = 'sent'; const STATUS_ARCHIVE = 'archive'; @@ -177,6 +219,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getStatusAllowableValues() @@ -194,13 +237,16 @@ public function getStatusAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -218,60 +264,60 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['status'] === null) { - $invalid_properties[] = "'status' can't be null"; + $invalidProperties[] = "'status' can't be null"; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['content'] === null) { - $invalid_properties[] = "'content' can't be null"; + $invalidProperties[] = "'content' can't be null"; } if ($this->container['scheduledAt'] === null) { - $invalid_properties[] = "'scheduledAt' can't be null"; + $invalidProperties[] = "'scheduledAt' can't be null"; } if ($this->container['testSent'] === null) { - $invalid_properties[] = "'testSent' can't be null"; + $invalidProperties[] = "'testSent' can't be null"; } if ($this->container['sender'] === null) { - $invalid_properties[] = "'sender' can't be null"; + $invalidProperties[] = "'sender' can't be null"; } if ($this->container['createdAt'] === null) { - $invalid_properties[] = "'createdAt' can't be null"; + $invalidProperties[] = "'createdAt' can't be null"; } if ($this->container['modifiedAt'] === null) { - $invalid_properties[] = "'modifiedAt' can't be null"; + $invalidProperties[] = "'modifiedAt' can't be null"; } if ($this->container['recipients'] === null) { - $invalid_properties[] = "'recipients' can't be null"; + $invalidProperties[] = "'recipients' can't be null"; } if ($this->container['statistics'] === null) { - $invalid_properties[] = "'statistics' can't be null"; + $invalidProperties[] = "'statistics' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -288,8 +334,8 @@ public function valid() if ($this->container['status'] === null) { return false; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { return false; } if ($this->container['content'] === null) { @@ -322,6 +368,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -331,7 +378,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the SMS Campaign + * * @return $this */ public function setId($id) @@ -343,6 +392,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -352,7 +402,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the SMS Campaign + * * @return $this */ public function setName($name) @@ -364,6 +416,7 @@ public function setName($name) /** * Gets status + * * @return string */ public function getStatus() @@ -373,17 +426,19 @@ public function getStatus() /** * Sets status + * * @param string $status Status of the SMS Campaign + * * @return $this */ public function setStatus($status) { - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($status, $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -394,6 +449,7 @@ public function setStatus($status) /** * Gets content + * * @return string */ public function getContent() @@ -403,7 +459,9 @@ public function getContent() /** * Sets content + * * @param string $content Content of the SMS Campaign + * * @return $this */ public function setContent($content) @@ -415,6 +473,7 @@ public function setContent($content) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -424,7 +483,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -436,6 +497,7 @@ public function setScheduledAt($scheduledAt) /** * Gets testSent + * * @return bool */ public function getTestSent() @@ -445,7 +507,9 @@ public function getTestSent() /** * Sets testSent + * * @param bool $testSent Retrieved the status of test SMS sending. (true=Test SMS has been sent false=Test SMS has not been sent) + * * @return $this */ public function setTestSent($testSent) @@ -457,6 +521,7 @@ public function setTestSent($testSent) /** * Gets sender + * * @return string */ public function getSender() @@ -466,7 +531,9 @@ public function getSender() /** * Sets sender + * * @param string $sender Sender of the SMS Campaign + * * @return $this */ public function setSender($sender) @@ -478,6 +545,7 @@ public function setSender($sender) /** * Gets createdAt + * * @return \DateTime */ public function getCreatedAt() @@ -487,7 +555,9 @@ public function getCreatedAt() /** * Sets createdAt + * * @param \DateTime $createdAt Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setCreatedAt($createdAt) @@ -499,6 +569,7 @@ public function setCreatedAt($createdAt) /** * Gets modifiedAt + * * @return \DateTime */ public function getModifiedAt() @@ -508,7 +579,9 @@ public function getModifiedAt() /** * Sets modifiedAt + * * @param \DateTime $modifiedAt UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setModifiedAt($modifiedAt) @@ -520,6 +593,7 @@ public function setModifiedAt($modifiedAt) /** * Gets recipients + * * @return object */ public function getRecipients() @@ -529,7 +603,9 @@ public function getRecipients() /** * Sets recipients - * @param object $recipients + * + * @param object $recipients recipients + * * @return $this */ public function setRecipients($recipients) @@ -541,6 +617,7 @@ public function setRecipients($recipients) /** * Gets statistics + * * @return object */ public function getStatistics() @@ -550,7 +627,9 @@ public function getStatistics() /** * Sets statistics - * @param object $statistics + * + * @param object $statistics statistics + * * @return $this */ public function setStatistics($statistics) @@ -561,7 +640,9 @@ public function setStatistics($statistics) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -571,7 +652,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -581,8 +664,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -596,7 +681,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -606,15 +693,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmsCampaignOverview.php b/lib/Model/GetSmsCampaignOverview.php index c847cdb0..3f1f9e2b 100644 --- a/lib/Model/GetSmsCampaignOverview.php +++ b/lib/Model/GetSmsCampaignOverview.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmsCampaignOverview Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmsCampaignOverview implements ArrayAccess +class GetSmsCampaignOverview implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmsCampaignOverview'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -67,6 +70,7 @@ class GetSmsCampaignOverview implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -81,18 +85,30 @@ class GetSmsCampaignOverview implements ArrayAccess 'modifiedAt' => 'date-time' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -107,9 +123,9 @@ public static function swaggerFormats() 'modifiedAt' => 'modifiedAt' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -124,9 +140,9 @@ public static function swaggerFormats() 'modifiedAt' => 'setModifiedAt' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -141,21 +157,47 @@ public static function swaggerFormats() 'modifiedAt' => 'getModifiedAt' ]; + /** + * 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 STATUS_DRAFT = 'draft'; const STATUS_SENT = 'sent'; const STATUS_ARCHIVE = 'archive'; @@ -167,6 +209,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getStatusAllowableValues() @@ -184,13 +227,16 @@ public function getStatusAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -206,54 +252,54 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['status'] === null) { - $invalid_properties[] = "'status' can't be null"; + $invalidProperties[] = "'status' can't be null"; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['content'] === null) { - $invalid_properties[] = "'content' can't be null"; + $invalidProperties[] = "'content' can't be null"; } if ($this->container['scheduledAt'] === null) { - $invalid_properties[] = "'scheduledAt' can't be null"; + $invalidProperties[] = "'scheduledAt' can't be null"; } if ($this->container['testSent'] === null) { - $invalid_properties[] = "'testSent' can't be null"; + $invalidProperties[] = "'testSent' can't be null"; } if ($this->container['sender'] === null) { - $invalid_properties[] = "'sender' can't be null"; + $invalidProperties[] = "'sender' can't be null"; } if ($this->container['createdAt'] === null) { - $invalid_properties[] = "'createdAt' can't be null"; + $invalidProperties[] = "'createdAt' can't be null"; } if ($this->container['modifiedAt'] === null) { - $invalid_properties[] = "'modifiedAt' can't be null"; + $invalidProperties[] = "'modifiedAt' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -270,8 +316,8 @@ public function valid() if ($this->container['status'] === null) { return false; } - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { return false; } if ($this->container['content'] === null) { @@ -298,6 +344,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -307,7 +354,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the SMS Campaign + * * @return $this */ public function setId($id) @@ -319,6 +368,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -328,7 +378,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the SMS Campaign + * * @return $this */ public function setName($name) @@ -340,6 +392,7 @@ public function setName($name) /** * Gets status + * * @return string */ public function getStatus() @@ -349,17 +402,19 @@ public function getStatus() /** * Sets status + * * @param string $status Status of the SMS Campaign + * * @return $this */ public function setStatus($status) { - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($status, $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -370,6 +425,7 @@ public function setStatus($status) /** * Gets content + * * @return string */ public function getContent() @@ -379,7 +435,9 @@ public function getContent() /** * Sets content + * * @param string $content Content of the SMS Campaign + * * @return $this */ public function setContent($content) @@ -391,6 +449,7 @@ public function setContent($content) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -400,7 +459,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -412,6 +473,7 @@ public function setScheduledAt($scheduledAt) /** * Gets testSent + * * @return bool */ public function getTestSent() @@ -421,7 +483,9 @@ public function getTestSent() /** * Sets testSent + * * @param bool $testSent Retrieved the status of test SMS sending. (true=Test SMS has been sent false=Test SMS has not been sent) + * * @return $this */ public function setTestSent($testSent) @@ -433,6 +497,7 @@ public function setTestSent($testSent) /** * Gets sender + * * @return string */ public function getSender() @@ -442,7 +507,9 @@ public function getSender() /** * Sets sender + * * @param string $sender Sender of the SMS Campaign + * * @return $this */ public function setSender($sender) @@ -454,6 +521,7 @@ public function setSender($sender) /** * Gets createdAt + * * @return \DateTime */ public function getCreatedAt() @@ -463,7 +531,9 @@ public function getCreatedAt() /** * Sets createdAt + * * @param \DateTime $createdAt Creation UTC date-time of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setCreatedAt($createdAt) @@ -475,6 +545,7 @@ public function setCreatedAt($createdAt) /** * Gets modifiedAt + * * @return \DateTime */ public function getModifiedAt() @@ -484,7 +555,9 @@ public function getModifiedAt() /** * Sets modifiedAt + * * @param \DateTime $modifiedAt UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setModifiedAt($modifiedAt) @@ -495,7 +568,9 @@ public function setModifiedAt($modifiedAt) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -505,7 +580,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -515,8 +592,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -530,7 +609,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -540,15 +621,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmsCampaignStats.php b/lib/Model/GetSmsCampaignStats.php index 48dca702..3b8f81e7 100644 --- a/lib/Model/GetSmsCampaignStats.php +++ b/lib/Model/GetSmsCampaignStats.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmsCampaignStats Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmsCampaignStats implements ArrayAccess +class GetSmsCampaignStats implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmsCampaignStats'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -65,6 +68,7 @@ class GetSmsCampaignStats implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -77,18 +81,30 @@ class GetSmsCampaignStats implements ArrayAccess 'answered' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -101,9 +117,9 @@ public static function swaggerFormats() 'answered' => 'answered' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -116,9 +132,9 @@ public static function swaggerFormats() 'answered' => 'setAnswered' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -131,34 +147,63 @@ public static function swaggerFormats() 'answered' => 'getAnswered' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -172,40 +217,40 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['delivered'] === null) { - $invalid_properties[] = "'delivered' can't be null"; + $invalidProperties[] = "'delivered' can't be null"; } if ($this->container['sent'] === null) { - $invalid_properties[] = "'sent' can't be null"; + $invalidProperties[] = "'sent' can't be null"; } if ($this->container['processing'] === null) { - $invalid_properties[] = "'processing' can't be null"; + $invalidProperties[] = "'processing' can't be null"; } if ($this->container['softBounces'] === null) { - $invalid_properties[] = "'softBounces' can't be null"; + $invalidProperties[] = "'softBounces' can't be null"; } if ($this->container['hardBounces'] === null) { - $invalid_properties[] = "'hardBounces' can't be null"; + $invalidProperties[] = "'hardBounces' can't be null"; } if ($this->container['unsubscriptions'] === null) { - $invalid_properties[] = "'unsubscriptions' can't be null"; + $invalidProperties[] = "'unsubscriptions' can't be null"; } if ($this->container['answered'] === null) { - $invalid_properties[] = "'answered' can't be null"; + $invalidProperties[] = "'answered' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -240,6 +285,7 @@ public function valid() /** * Gets delivered + * * @return int */ public function getDelivered() @@ -249,7 +295,9 @@ public function getDelivered() /** * Sets delivered + * * @param int $delivered Number of delivered SMS + * * @return $this */ public function setDelivered($delivered) @@ -261,6 +309,7 @@ public function setDelivered($delivered) /** * Gets sent + * * @return int */ public function getSent() @@ -270,7 +319,9 @@ public function getSent() /** * Sets sent + * * @param int $sent Number of sent SMS + * * @return $this */ public function setSent($sent) @@ -282,6 +333,7 @@ public function setSent($sent) /** * Gets processing + * * @return int */ public function getProcessing() @@ -291,7 +343,9 @@ public function getProcessing() /** * Sets processing + * * @param int $processing Number of processing SMS + * * @return $this */ public function setProcessing($processing) @@ -303,6 +357,7 @@ public function setProcessing($processing) /** * Gets softBounces + * * @return int */ public function getSoftBounces() @@ -312,7 +367,9 @@ public function getSoftBounces() /** * Sets softBounces + * * @param int $softBounces Number of softbounced SMS + * * @return $this */ public function setSoftBounces($softBounces) @@ -324,6 +381,7 @@ public function setSoftBounces($softBounces) /** * Gets hardBounces + * * @return int */ public function getHardBounces() @@ -333,7 +391,9 @@ public function getHardBounces() /** * Sets hardBounces + * * @param int $hardBounces Number of hardbounced SMS + * * @return $this */ public function setHardBounces($hardBounces) @@ -345,6 +405,7 @@ public function setHardBounces($hardBounces) /** * Gets unsubscriptions + * * @return int */ public function getUnsubscriptions() @@ -354,7 +415,9 @@ public function getUnsubscriptions() /** * Sets unsubscriptions + * * @param int $unsubscriptions Number of unsubscription SMS + * * @return $this */ public function setUnsubscriptions($unsubscriptions) @@ -366,6 +429,7 @@ public function setUnsubscriptions($unsubscriptions) /** * Gets answered + * * @return int */ public function getAnswered() @@ -375,7 +439,9 @@ public function getAnswered() /** * Sets answered + * * @param int $answered Number of replies to the SMS + * * @return $this */ public function setAnswered($answered) @@ -386,7 +452,9 @@ public function setAnswered($answered) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -396,7 +464,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -406,8 +476,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -421,7 +493,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -431,15 +505,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmsCampaigns.php b/lib/Model/GetSmsCampaigns.php index 3d24fb06..8e1fb955 100644 --- a/lib/Model/GetSmsCampaigns.php +++ b/lib/Model/GetSmsCampaigns.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmsCampaigns Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmsCampaigns implements ArrayAccess +class GetSmsCampaigns implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmsCampaigns'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetSmsCampaigns implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetSmsCampaigns implements ArrayAccess 'count' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'count' => 'count' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'count' => 'setCount' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'count' => 'getCount' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +187,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['count'] === null) { - $invalid_properties[] = "'count' can't be null"; + $invalidProperties[] = "'count' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets campaigns + * * @return object[] */ public function getCampaigns() @@ -183,7 +229,9 @@ public function getCampaigns() /** * Sets campaigns - * @param object[] $campaigns + * + * @param object[] $campaigns campaigns + * * @return $this */ public function setCampaigns($campaigns) @@ -195,6 +243,7 @@ public function setCampaigns($campaigns) /** * Gets count + * * @return int */ public function getCount() @@ -204,7 +253,9 @@ public function getCount() /** * Sets count + * * @param int $count Number of SMS campaigns retrieved + * * @return $this */ public function setCount($count) @@ -215,7 +266,9 @@ public function setCount($count) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +278,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +307,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +319,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmsEventReport.php b/lib/Model/GetSmsEventReport.php index 5b63eee9..4fc3fe47 100644 --- a/lib/Model/GetSmsEventReport.php +++ b/lib/Model/GetSmsEventReport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmsEventReport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmsEventReport implements ArrayAccess +class GetSmsEventReport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmsEventReport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetSmsEventReport implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'events' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'events' => 'events' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'events' => 'setEvents' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'events' => 'getEvents' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets events + * * @return \SendinBlue\Client\Model\GetSmsEventReportEvents[] */ public function getEvents() @@ -171,7 +217,9 @@ public function getEvents() /** * Sets events - * @param \SendinBlue\Client\Model\GetSmsEventReportEvents[] $events + * + * @param \SendinBlue\Client\Model\GetSmsEventReportEvents[] $events events + * * @return $this */ public function setEvents($events) @@ -182,7 +230,9 @@ public function setEvents($events) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmsEventReportEvents.php b/lib/Model/GetSmsEventReportEvents.php index 7548a53f..886c5cc1 100644 --- a/lib/Model/GetSmsEventReportEvents.php +++ b/lib/Model/GetSmsEventReportEvents.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmsEventReportEvents Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmsEventReportEvents implements ArrayAccess +class GetSmsEventReportEvents implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmsEventReport_events'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -65,6 +68,7 @@ class GetSmsEventReportEvents implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -77,18 +81,30 @@ class GetSmsEventReportEvents implements ArrayAccess 'tag' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -101,9 +117,9 @@ public static function swaggerFormats() 'tag' => 'tag' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -116,9 +132,9 @@ public static function swaggerFormats() 'tag' => 'setTag' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -131,21 +147,47 @@ public static function swaggerFormats() 'tag' => 'getTag' ]; + /** + * 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 EVENT_BOUNCES = 'bounces'; const EVENT_HARD_BOUNCES = 'hardBounces'; const EVENT_SOFT_BOUNCES = 'softBounces'; @@ -160,6 +202,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getEventAllowableValues() @@ -180,13 +223,16 @@ public function getEventAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -200,39 +246,39 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['phoneNumber'] === null) { - $invalid_properties[] = "'phoneNumber' can't be null"; + $invalidProperties[] = "'phoneNumber' can't be null"; } if ($this->container['date'] === null) { - $invalid_properties[] = "'date' can't be null"; + $invalidProperties[] = "'date' can't be null"; } if ($this->container['messageId'] === null) { - $invalid_properties[] = "'messageId' can't be null"; + $invalidProperties[] = "'messageId' can't be null"; } if ($this->container['event'] === null) { - $invalid_properties[] = "'event' can't be null"; + $invalidProperties[] = "'event' can't be null"; } - $allowed_values = $this->getEventAllowableValues(); - if (!in_array($this->container['event'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($this->container['event'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'event', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -252,8 +298,8 @@ public function valid() if ($this->container['event'] === null) { return false; } - $allowed_values = $this->getEventAllowableValues(); - if (!in_array($this->container['event'], $allowed_values)) { + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($this->container['event'], $allowedValues)) { return false; } return true; @@ -262,6 +308,7 @@ public function valid() /** * Gets phoneNumber + * * @return string */ public function getPhoneNumber() @@ -271,7 +318,9 @@ public function getPhoneNumber() /** * Sets phoneNumber + * * @param string $phoneNumber Phone number which has generated the event + * * @return $this */ public function setPhoneNumber($phoneNumber) @@ -283,6 +332,7 @@ public function setPhoneNumber($phoneNumber) /** * Gets date + * * @return \DateTime */ public function getDate() @@ -292,7 +342,9 @@ public function getDate() /** * Sets date + * * @param \DateTime $date Date on which the event has been generated + * * @return $this */ public function setDate($date) @@ -304,6 +356,7 @@ public function setDate($date) /** * Gets messageId + * * @return string */ public function getMessageId() @@ -313,7 +366,9 @@ public function getMessageId() /** * Sets messageId + * * @param string $messageId Message ID which generated the event + * * @return $this */ public function setMessageId($messageId) @@ -325,6 +380,7 @@ public function setMessageId($messageId) /** * Gets event + * * @return string */ public function getEvent() @@ -334,17 +390,19 @@ public function getEvent() /** * Sets event + * * @param string $event Event which occurred + * * @return $this */ public function setEvent($event) { - $allowed_values = $this->getEventAllowableValues(); - if (!in_array($event, $allowed_values)) { + $allowedValues = $this->getEventAllowableValues(); + if (!in_array($event, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'event', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -355,6 +413,7 @@ public function setEvent($event) /** * Gets reason + * * @return string */ public function getReason() @@ -364,7 +423,9 @@ public function getReason() /** * Sets reason + * * @param string $reason Reason of bounce (only available if the event is hardbounce or softbounce) + * * @return $this */ public function setReason($reason) @@ -376,6 +437,7 @@ public function setReason($reason) /** * Gets reply + * * @return string */ public function getReply() @@ -385,7 +447,9 @@ public function getReply() /** * Sets reply - * @param string $reply + * + * @param string $reply reply + * * @return $this */ public function setReply($reply) @@ -397,6 +461,7 @@ public function setReply($reply) /** * Gets tag + * * @return string */ public function getTag() @@ -406,7 +471,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the SMS which generated the event + * * @return $this */ public function setTag($tag) @@ -417,7 +484,9 @@ public function setTag($tag) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -427,7 +496,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -437,8 +508,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -452,7 +525,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -462,15 +537,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmtpTemplateOverview.php b/lib/Model/GetSmtpTemplateOverview.php index 93c7dc1a..fc119b0d 100644 --- a/lib/Model/GetSmtpTemplateOverview.php +++ b/lib/Model/GetSmtpTemplateOverview.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmtpTemplateOverview Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmtpTemplateOverview implements ArrayAccess +class GetSmtpTemplateOverview implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmtpTemplateOverview'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -70,6 +73,7 @@ class GetSmtpTemplateOverview implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -87,18 +91,30 @@ class GetSmtpTemplateOverview implements ArrayAccess 'modifiedAt' => 'date-time' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -116,9 +132,9 @@ public static function swaggerFormats() 'modifiedAt' => 'modifiedAt' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -136,9 +152,9 @@ public static function swaggerFormats() 'modifiedAt' => 'setModifiedAt' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -156,34 +172,63 @@ public static function swaggerFormats() 'modifiedAt' => 'getModifiedAt' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -202,52 +247,55 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['name'] === null) { - $invalid_properties[] = "'name' can't be null"; + $invalidProperties[] = "'name' can't be null"; } if ($this->container['subject'] === null) { - $invalid_properties[] = "'subject' can't be null"; + $invalidProperties[] = "'subject' can't be null"; } if ($this->container['isActive'] === null) { - $invalid_properties[] = "'isActive' can't be null"; + $invalidProperties[] = "'isActive' can't be null"; } if ($this->container['testSent'] === null) { - $invalid_properties[] = "'testSent' can't be null"; + $invalidProperties[] = "'testSent' can't be null"; + } + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; } if ($this->container['replyTo'] === null) { - $invalid_properties[] = "'replyTo' can't be null"; + $invalidProperties[] = "'replyTo' can't be null"; } if ($this->container['toField'] === null) { - $invalid_properties[] = "'toField' can't be null"; + $invalidProperties[] = "'toField' can't be null"; } if ($this->container['tag'] === null) { - $invalid_properties[] = "'tag' can't be null"; + $invalidProperties[] = "'tag' can't be null"; } if ($this->container['htmlContent'] === null) { - $invalid_properties[] = "'htmlContent' can't be null"; + $invalidProperties[] = "'htmlContent' can't be null"; } if ($this->container['createdAt'] === null) { - $invalid_properties[] = "'createdAt' can't be null"; + $invalidProperties[] = "'createdAt' can't be null"; } if ($this->container['modifiedAt'] === null) { - $invalid_properties[] = "'modifiedAt' can't be null"; + $invalidProperties[] = "'modifiedAt' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -270,6 +318,9 @@ public function valid() if ($this->container['testSent'] === null) { return false; } + if ($this->container['sender'] === null) { + return false; + } if ($this->container['replyTo'] === null) { return false; } @@ -294,6 +345,7 @@ public function valid() /** * Gets id + * * @return int */ public function getId() @@ -303,7 +355,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the template + * * @return $this */ public function setId($id) @@ -315,6 +369,7 @@ public function setId($id) /** * Gets name + * * @return string */ public function getName() @@ -324,7 +379,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the template + * * @return $this */ public function setName($name) @@ -336,6 +393,7 @@ public function setName($name) /** * Gets subject + * * @return string */ public function getSubject() @@ -345,7 +403,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the template + * * @return $this */ public function setSubject($subject) @@ -357,6 +417,7 @@ public function setSubject($subject) /** * Gets isActive + * * @return bool */ public function getIsActive() @@ -366,7 +427,9 @@ public function getIsActive() /** * Sets isActive + * * @param bool $isActive Status of template (true=active, false=inactive) + * * @return $this */ public function setIsActive($isActive) @@ -378,6 +441,7 @@ public function setIsActive($isActive) /** * Gets testSent + * * @return bool */ public function getTestSent() @@ -387,7 +451,9 @@ public function getTestSent() /** * Sets testSent + * * @param bool $testSent Status of test sending for the template (true=test email has been sent, false=test email has not been sent) + * * @return $this */ public function setTestSent($testSent) @@ -399,6 +465,7 @@ public function setTestSent($testSent) /** * Gets sender + * * @return \SendinBlue\Client\Model\GetSmtpTemplateOverviewSender */ public function getSender() @@ -408,7 +475,9 @@ public function getSender() /** * Sets sender - * @param \SendinBlue\Client\Model\GetSmtpTemplateOverviewSender $sender + * + * @param \SendinBlue\Client\Model\GetSmtpTemplateOverviewSender $sender sender + * * @return $this */ public function setSender($sender) @@ -420,6 +489,7 @@ public function setSender($sender) /** * Gets replyTo + * * @return string */ public function getReplyTo() @@ -429,7 +499,9 @@ public function getReplyTo() /** * Sets replyTo + * * @param string $replyTo Email defined as the \"Reply to\" for the template + * * @return $this */ public function setReplyTo($replyTo) @@ -441,6 +513,7 @@ public function setReplyTo($replyTo) /** * Gets toField + * * @return string */ public function getToField() @@ -450,7 +523,9 @@ public function getToField() /** * Sets toField + * * @param string $toField Customisation of the \"to\" field for the template + * * @return $this */ public function setToField($toField) @@ -462,6 +537,7 @@ public function setToField($toField) /** * Gets tag + * * @return string */ public function getTag() @@ -471,7 +547,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the template + * * @return $this */ public function setTag($tag) @@ -483,6 +561,7 @@ public function setTag($tag) /** * Gets htmlContent + * * @return string */ public function getHtmlContent() @@ -492,7 +571,9 @@ public function getHtmlContent() /** * Sets htmlContent + * * @param string $htmlContent HTML content of the template + * * @return $this */ public function setHtmlContent($htmlContent) @@ -504,6 +585,7 @@ public function setHtmlContent($htmlContent) /** * Gets createdAt + * * @return \DateTime */ public function getCreatedAt() @@ -513,7 +595,9 @@ public function getCreatedAt() /** * Sets createdAt + * * @param \DateTime $createdAt Creation UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setCreatedAt($createdAt) @@ -525,6 +609,7 @@ public function setCreatedAt($createdAt) /** * Gets modifiedAt + * * @return \DateTime */ public function getModifiedAt() @@ -534,7 +619,9 @@ public function getModifiedAt() /** * Sets modifiedAt + * * @param \DateTime $modifiedAt Last modification UTC date-time of the template (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setModifiedAt($modifiedAt) @@ -545,7 +632,9 @@ public function setModifiedAt($modifiedAt) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -555,7 +644,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -565,8 +656,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -580,7 +673,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -590,15 +685,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmtpTemplateOverviewSender.php b/lib/Model/GetSmtpTemplateOverviewSender.php index a9f59866..7ae6e3fa 100644 --- a/lib/Model/GetSmtpTemplateOverviewSender.php +++ b/lib/Model/GetSmtpTemplateOverviewSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmtpTemplateOverviewSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmtpTemplateOverviewSender implements ArrayAccess +class GetSmtpTemplateOverviewSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmtpTemplateOverview_sender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetSmtpTemplateOverviewSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetSmtpTemplateOverviewSender implements ArrayAccess 'email' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -177,7 +223,9 @@ public function getName() /** * Sets name + * * @param string $name From email for the template + * * @return $this */ public function setName($name) @@ -189,6 +237,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -198,7 +247,9 @@ public function getEmail() /** * Sets email + * * @param string $email From email for the template + * * @return $this */ public function setEmail($email) @@ -209,7 +260,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetSmtpTemplates.php b/lib/Model/GetSmtpTemplates.php index 964d6e14..98d23249 100644 --- a/lib/Model/GetSmtpTemplates.php +++ b/lib/Model/GetSmtpTemplates.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetSmtpTemplates Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetSmtpTemplates implements ArrayAccess +class GetSmtpTemplates implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getSmtpTemplates'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class GetSmtpTemplates implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class GetSmtpTemplates implements ArrayAccess 'templates' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'templates' => 'templates' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'templates' => 'setTemplates' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'templates' => 'getTemplates' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets count + * * @return int */ public function getCount() @@ -177,7 +223,9 @@ public function getCount() /** * Sets count + * * @param int $count Count of smtp templates + * * @return $this */ public function setCount($count) @@ -189,6 +237,7 @@ public function setCount($count) /** * Gets templates + * * @return \SendinBlue\Client\Model\GetSmtpTemplateOverview[] */ public function getTemplates() @@ -198,7 +247,9 @@ public function getTemplates() /** * Sets templates - * @param \SendinBlue\Client\Model\GetSmtpTemplateOverview[] $templates + * + * @param \SendinBlue\Client\Model\GetSmtpTemplateOverview[] $templates templates + * * @return $this */ public function setTemplates($templates) @@ -209,7 +260,9 @@ public function setTemplates($templates) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetStatsByDomain.php b/lib/Model/GetStatsByDomain.php index a2c52673..cedf4f07 100644 --- a/lib/Model/GetStatsByDomain.php +++ b/lib/Model/GetStatsByDomain.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetStatsByDomain Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetStatsByDomain implements ArrayAccess +class GetStatsByDomain implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getStatsByDomain'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,95 +62,137 @@ class GetStatsByDomain implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = parent::listInvalidProperties(); + $invalidProperties = parent::listInvalidProperties(); - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -163,7 +208,9 @@ public function valid() /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -173,7 +220,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -183,8 +232,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -198,7 +249,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -208,15 +261,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetTransacAggregatedSmsReport.php b/lib/Model/GetTransacAggregatedSmsReport.php index f6c76ea4..57bb5016 100644 --- a/lib/Model/GetTransacAggregatedSmsReport.php +++ b/lib/Model/GetTransacAggregatedSmsReport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetTransacAggregatedSmsReport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetTransacAggregatedSmsReport implements ArrayAccess +class GetTransacAggregatedSmsReport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getTransacAggregatedSmsReport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -68,6 +71,7 @@ class GetTransacAggregatedSmsReport implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -83,18 +87,30 @@ class GetTransacAggregatedSmsReport implements ArrayAccess 'rejected' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -110,9 +126,9 @@ public static function swaggerFormats() 'rejected' => 'rejected' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -128,9 +144,9 @@ public static function swaggerFormats() 'rejected' => 'setRejected' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -146,34 +162,63 @@ public static function swaggerFormats() 'rejected' => 'getRejected' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -190,49 +235,49 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['range'] === null) { - $invalid_properties[] = "'range' can't be null"; + $invalidProperties[] = "'range' can't be null"; } if ($this->container['requests'] === null) { - $invalid_properties[] = "'requests' can't be null"; + $invalidProperties[] = "'requests' can't be null"; } if ($this->container['delivered'] === null) { - $invalid_properties[] = "'delivered' can't be null"; + $invalidProperties[] = "'delivered' can't be null"; } if ($this->container['hardBounces'] === null) { - $invalid_properties[] = "'hardBounces' can't be null"; + $invalidProperties[] = "'hardBounces' can't be null"; } if ($this->container['softBounces'] === null) { - $invalid_properties[] = "'softBounces' can't be null"; + $invalidProperties[] = "'softBounces' can't be null"; } if ($this->container['blocked'] === null) { - $invalid_properties[] = "'blocked' can't be null"; + $invalidProperties[] = "'blocked' can't be null"; } if ($this->container['unsubscribed'] === null) { - $invalid_properties[] = "'unsubscribed' can't be null"; + $invalidProperties[] = "'unsubscribed' can't be null"; } if ($this->container['replied'] === null) { - $invalid_properties[] = "'replied' can't be null"; + $invalidProperties[] = "'replied' can't be null"; } if ($this->container['accepted'] === null) { - $invalid_properties[] = "'accepted' can't be null"; + $invalidProperties[] = "'accepted' can't be null"; } if ($this->container['rejected'] === null) { - $invalid_properties[] = "'rejected' can't be null"; + $invalidProperties[] = "'rejected' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -276,6 +321,7 @@ public function valid() /** * Gets range + * * @return string */ public function getRange() @@ -285,7 +331,9 @@ public function getRange() /** * Sets range + * * @param string $range Time frame of the report + * * @return $this */ public function setRange($range) @@ -297,6 +345,7 @@ public function setRange($range) /** * Gets requests + * * @return int */ public function getRequests() @@ -306,7 +355,9 @@ public function getRequests() /** * Sets requests + * * @param int $requests Number of requests for the timeframe + * * @return $this */ public function setRequests($requests) @@ -318,6 +369,7 @@ public function setRequests($requests) /** * Gets delivered + * * @return int */ public function getDelivered() @@ -327,7 +379,9 @@ public function getDelivered() /** * Sets delivered + * * @param int $delivered Number of delivered SMS for the timeframe + * * @return $this */ public function setDelivered($delivered) @@ -339,6 +393,7 @@ public function setDelivered($delivered) /** * Gets hardBounces + * * @return int */ public function getHardBounces() @@ -348,7 +403,9 @@ public function getHardBounces() /** * Sets hardBounces + * * @param int $hardBounces Number of hardbounces for the timeframe + * * @return $this */ public function setHardBounces($hardBounces) @@ -360,6 +417,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces + * * @return int */ public function getSoftBounces() @@ -369,7 +427,9 @@ public function getSoftBounces() /** * Sets softBounces + * * @param int $softBounces Number of softbounces for the timeframe + * * @return $this */ public function setSoftBounces($softBounces) @@ -381,6 +441,7 @@ public function setSoftBounces($softBounces) /** * Gets blocked + * * @return int */ public function getBlocked() @@ -390,7 +451,9 @@ public function getBlocked() /** * Sets blocked + * * @param int $blocked Number of blocked contact for the timeframe + * * @return $this */ public function setBlocked($blocked) @@ -402,6 +465,7 @@ public function setBlocked($blocked) /** * Gets unsubscribed + * * @return int */ public function getUnsubscribed() @@ -411,7 +475,9 @@ public function getUnsubscribed() /** * Sets unsubscribed + * * @param int $unsubscribed Number of unsubscription for the timeframe + * * @return $this */ public function setUnsubscribed($unsubscribed) @@ -423,6 +489,7 @@ public function setUnsubscribed($unsubscribed) /** * Gets replied + * * @return int */ public function getReplied() @@ -432,7 +499,9 @@ public function getReplied() /** * Sets replied + * * @param int $replied Number of answered SMS for the timeframe + * * @return $this */ public function setReplied($replied) @@ -444,6 +513,7 @@ public function setReplied($replied) /** * Gets accepted + * * @return int */ public function getAccepted() @@ -453,7 +523,9 @@ public function getAccepted() /** * Sets accepted + * * @param int $accepted Number of accepted for the timeframe + * * @return $this */ public function setAccepted($accepted) @@ -465,6 +537,7 @@ public function setAccepted($accepted) /** * Gets rejected + * * @return int */ public function getRejected() @@ -474,7 +547,9 @@ public function getRejected() /** * Sets rejected + * * @param int $rejected Number of rejected for the timeframe + * * @return $this */ public function setRejected($rejected) @@ -485,7 +560,9 @@ public function setRejected($rejected) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -495,7 +572,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -505,8 +584,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -520,7 +601,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -530,15 +613,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetTransacSmsReport.php b/lib/Model/GetTransacSmsReport.php index d6ae74c6..8de91a6f 100644 --- a/lib/Model/GetTransacSmsReport.php +++ b/lib/Model/GetTransacSmsReport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetTransacSmsReport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetTransacSmsReport implements ArrayAccess +class GetTransacSmsReport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getTransacSmsReport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetTransacSmsReport implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'reports' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'reports' => 'reports' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'reports' => 'setReports' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'reports' => 'getReports' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets reports + * * @return \SendinBlue\Client\Model\GetTransacSmsReportReports[] */ public function getReports() @@ -171,7 +217,9 @@ public function getReports() /** * Sets reports - * @param \SendinBlue\Client\Model\GetTransacSmsReportReports[] $reports + * + * @param \SendinBlue\Client\Model\GetTransacSmsReportReports[] $reports reports + * * @return $this */ public function setReports($reports) @@ -182,7 +230,9 @@ public function setReports($reports) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetTransacSmsReportReports.php b/lib/Model/GetTransacSmsReportReports.php index dcb90c82..232e1e84 100644 --- a/lib/Model/GetTransacSmsReportReports.php +++ b/lib/Model/GetTransacSmsReportReports.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetTransacSmsReportReports Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetTransacSmsReportReports implements ArrayAccess +class GetTransacSmsReportReports implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getTransacSmsReport_reports'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -68,6 +71,7 @@ class GetTransacSmsReportReports implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -83,18 +87,30 @@ class GetTransacSmsReportReports implements ArrayAccess 'rejected' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -110,9 +126,9 @@ public static function swaggerFormats() 'rejected' => 'rejected' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -128,9 +144,9 @@ public static function swaggerFormats() 'rejected' => 'setRejected' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -146,34 +162,63 @@ public static function swaggerFormats() 'rejected' => 'getRejected' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -190,49 +235,49 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['date'] === null) { - $invalid_properties[] = "'date' can't be null"; + $invalidProperties[] = "'date' can't be null"; } if ($this->container['requests'] === null) { - $invalid_properties[] = "'requests' can't be null"; + $invalidProperties[] = "'requests' can't be null"; } if ($this->container['delivered'] === null) { - $invalid_properties[] = "'delivered' can't be null"; + $invalidProperties[] = "'delivered' can't be null"; } if ($this->container['hardBounces'] === null) { - $invalid_properties[] = "'hardBounces' can't be null"; + $invalidProperties[] = "'hardBounces' can't be null"; } if ($this->container['softBounces'] === null) { - $invalid_properties[] = "'softBounces' can't be null"; + $invalidProperties[] = "'softBounces' can't be null"; } if ($this->container['blocked'] === null) { - $invalid_properties[] = "'blocked' can't be null"; + $invalidProperties[] = "'blocked' can't be null"; } if ($this->container['unsubscribed'] === null) { - $invalid_properties[] = "'unsubscribed' can't be null"; + $invalidProperties[] = "'unsubscribed' can't be null"; } if ($this->container['replied'] === null) { - $invalid_properties[] = "'replied' can't be null"; + $invalidProperties[] = "'replied' can't be null"; } if ($this->container['accepted'] === null) { - $invalid_properties[] = "'accepted' can't be null"; + $invalidProperties[] = "'accepted' can't be null"; } if ($this->container['rejected'] === null) { - $invalid_properties[] = "'rejected' can't be null"; + $invalidProperties[] = "'rejected' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -276,6 +321,7 @@ public function valid() /** * Gets date + * * @return \DateTime */ public function getDate() @@ -285,7 +331,9 @@ public function getDate() /** * Sets date + * * @param \DateTime $date Date for which statistics are retrieved + * * @return $this */ public function setDate($date) @@ -297,6 +345,7 @@ public function setDate($date) /** * Gets requests + * * @return int */ public function getRequests() @@ -306,7 +355,9 @@ public function getRequests() /** * Sets requests + * * @param int $requests Number of requests for the date + * * @return $this */ public function setRequests($requests) @@ -318,6 +369,7 @@ public function setRequests($requests) /** * Gets delivered + * * @return int */ public function getDelivered() @@ -327,7 +379,9 @@ public function getDelivered() /** * Sets delivered + * * @param int $delivered Number of delivered SMS for the date + * * @return $this */ public function setDelivered($delivered) @@ -339,6 +393,7 @@ public function setDelivered($delivered) /** * Gets hardBounces + * * @return int */ public function getHardBounces() @@ -348,7 +403,9 @@ public function getHardBounces() /** * Sets hardBounces + * * @param int $hardBounces Number of hardbounces for the date + * * @return $this */ public function setHardBounces($hardBounces) @@ -360,6 +417,7 @@ public function setHardBounces($hardBounces) /** * Gets softBounces + * * @return int */ public function getSoftBounces() @@ -369,7 +427,9 @@ public function getSoftBounces() /** * Sets softBounces + * * @param int $softBounces Number of softbounces for the date + * * @return $this */ public function setSoftBounces($softBounces) @@ -381,6 +441,7 @@ public function setSoftBounces($softBounces) /** * Gets blocked + * * @return int */ public function getBlocked() @@ -390,7 +451,9 @@ public function getBlocked() /** * Sets blocked + * * @param int $blocked Number of blocked contact for the date + * * @return $this */ public function setBlocked($blocked) @@ -402,6 +465,7 @@ public function setBlocked($blocked) /** * Gets unsubscribed + * * @return int */ public function getUnsubscribed() @@ -411,7 +475,9 @@ public function getUnsubscribed() /** * Sets unsubscribed + * * @param int $unsubscribed Number of unsubscription for the date + * * @return $this */ public function setUnsubscribed($unsubscribed) @@ -423,6 +489,7 @@ public function setUnsubscribed($unsubscribed) /** * Gets replied + * * @return int */ public function getReplied() @@ -432,7 +499,9 @@ public function getReplied() /** * Sets replied + * * @param int $replied Number of answered SMS for the date + * * @return $this */ public function setReplied($replied) @@ -444,6 +513,7 @@ public function setReplied($replied) /** * Gets accepted + * * @return int */ public function getAccepted() @@ -453,7 +523,9 @@ public function getAccepted() /** * Sets accepted + * * @param int $accepted Number of accepted for the date + * * @return $this */ public function setAccepted($accepted) @@ -465,6 +537,7 @@ public function setAccepted($accepted) /** * Gets rejected + * * @return int */ public function getRejected() @@ -474,7 +547,9 @@ public function getRejected() /** * Sets rejected + * * @param int $rejected Number of rejected for the date + * * @return $this */ public function setRejected($rejected) @@ -485,7 +560,9 @@ public function setRejected($rejected) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -495,7 +572,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -505,8 +584,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -520,7 +601,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -530,15 +613,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetWebhook.php b/lib/Model/GetWebhook.php index a7512a50..be799198 100644 --- a/lib/Model/GetWebhook.php +++ b/lib/Model/GetWebhook.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetWebhook Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetWebhook implements ArrayAccess +class GetWebhook implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getWebhook'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -65,6 +68,7 @@ class GetWebhook implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -77,18 +81,30 @@ class GetWebhook implements ArrayAccess 'modifiedAt' => 'date-time' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -101,9 +117,9 @@ public static function swaggerFormats() 'modifiedAt' => 'modifiedAt' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -116,9 +132,9 @@ public static function swaggerFormats() 'modifiedAt' => 'setModifiedAt' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -131,21 +147,47 @@ public static function swaggerFormats() 'modifiedAt' => 'getModifiedAt' ]; + /** + * 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 TYPE_MARKETING = 'marketing'; const TYPE_TRANSAC = 'transac'; @@ -153,6 +195,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -166,13 +209,16 @@ public function getTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -186,48 +232,48 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['url'] === null) { - $invalid_properties[] = "'url' can't be null"; + $invalidProperties[] = "'url' can't be null"; } if ($this->container['id'] === null) { - $invalid_properties[] = "'id' can't be null"; + $invalidProperties[] = "'id' can't be null"; } if ($this->container['description'] === null) { - $invalid_properties[] = "'description' can't be null"; + $invalidProperties[] = "'description' can't be null"; } if ($this->container['events'] === null) { - $invalid_properties[] = "'events' can't be null"; + $invalidProperties[] = "'events' can't be null"; } if ($this->container['type'] === null) { - $invalid_properties[] = "'type' can't be null"; + $invalidProperties[] = "'type' can't be null"; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } if ($this->container['createdAt'] === null) { - $invalid_properties[] = "'createdAt' can't be null"; + $invalidProperties[] = "'createdAt' can't be null"; } if ($this->container['modifiedAt'] === null) { - $invalid_properties[] = "'modifiedAt' can't be null"; + $invalidProperties[] = "'modifiedAt' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -250,8 +296,8 @@ public function valid() if ($this->container['type'] === null) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } if ($this->container['createdAt'] === null) { @@ -266,6 +312,7 @@ public function valid() /** * Gets url + * * @return string */ public function getUrl() @@ -275,7 +322,9 @@ public function getUrl() /** * Sets url + * * @param string $url URL of the webhook + * * @return $this */ public function setUrl($url) @@ -287,6 +336,7 @@ public function setUrl($url) /** * Gets id + * * @return int */ public function getId() @@ -296,7 +346,9 @@ public function getId() /** * Sets id + * * @param int $id ID of the webhook + * * @return $this */ public function setId($id) @@ -308,6 +360,7 @@ public function setId($id) /** * Gets description + * * @return string */ public function getDescription() @@ -317,7 +370,9 @@ public function getDescription() /** * Sets description + * * @param string $description Description of the webhook + * * @return $this */ public function setDescription($description) @@ -329,6 +384,7 @@ public function setDescription($description) /** * Gets events + * * @return string[] */ public function getEvents() @@ -338,7 +394,9 @@ public function getEvents() /** * Sets events - * @param string[] $events + * + * @param string[] $events events + * * @return $this */ public function setEvents($events) @@ -350,6 +408,7 @@ public function setEvents($events) /** * Gets type + * * @return string */ public function getType() @@ -359,17 +418,19 @@ public function getType() /** * Sets type + * * @param string $type Type of webhook (marketing or transac) + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -380,6 +441,7 @@ public function setType($type) /** * Gets createdAt + * * @return \DateTime */ public function getCreatedAt() @@ -389,7 +451,9 @@ public function getCreatedAt() /** * Sets createdAt + * * @param \DateTime $createdAt Creation UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setCreatedAt($createdAt) @@ -401,6 +465,7 @@ public function setCreatedAt($createdAt) /** * Gets modifiedAt + * * @return \DateTime */ public function getModifiedAt() @@ -410,7 +475,9 @@ public function getModifiedAt() /** * Sets modifiedAt + * * @param \DateTime $modifiedAt Last modification UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) + * * @return $this */ public function setModifiedAt($modifiedAt) @@ -421,7 +488,9 @@ public function setModifiedAt($modifiedAt) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -431,7 +500,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -441,8 +512,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -456,7 +529,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -466,15 +541,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/GetWebhooks.php b/lib/Model/GetWebhooks.php index e0c7f5a4..302be51f 100644 --- a/lib/Model/GetWebhooks.php +++ b/lib/Model/GetWebhooks.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * GetWebhooks Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class GetWebhooks implements ArrayAccess +class GetWebhooks implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'getWebhooks'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class GetWebhooks implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'webhooks' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'webhooks' => 'webhooks' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'webhooks' => 'setWebhooks' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'webhooks' => 'getWebhooks' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['webhooks'] === null) { - $invalid_properties[] = "'webhooks' can't be null"; + $invalidProperties[] = "'webhooks' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets webhooks + * * @return object[] */ public function getWebhooks() @@ -177,7 +223,9 @@ public function getWebhooks() /** * Sets webhooks - * @param object[] $webhooks + * + * @param object[] $webhooks webhooks + * * @return $this */ public function setWebhooks($webhooks) @@ -188,7 +236,9 @@ public function setWebhooks($webhooks) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/ManageIp.php b/lib/Model/ManageIp.php index f50393d3..9fc28a7d 100644 --- a/lib/Model/ManageIp.php +++ b/lib/Model/ManageIp.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * ManageIp Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class ManageIp implements ArrayAccess +class ManageIp implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'manageIp'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class ManageIp implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'ip' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'ip' => 'ip' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'ip' => 'setIp' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'ip' => 'getIp' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets ip + * * @return string */ public function getIp() @@ -171,7 +217,9 @@ public function getIp() /** * Sets ip + * * @param string $ip Dedicated ID + * * @return $this */ public function setIp($ip) @@ -182,7 +230,9 @@ public function setIp($ip) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php new file mode 100644 index 00000000..79f6796d --- /dev/null +++ b/lib/Model/ModelInterface.php @@ -0,0 +1,96 @@ + 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'contacts' => 'contacts' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'contacts' => 'setContacts' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'contacts' => 'getContacts' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + if ($this->container['contacts'] === null) { + $invalidProperties[] = "'contacts' can't be null"; + } + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -156,12 +204,16 @@ public function listInvalidProperties() public function valid() { + if ($this->container['contacts'] === null) { + return false; + } return true; } /** * Gets contacts + * * @return \SendinBlue\Client\Model\PostContactInfoContacts */ public function getContacts() @@ -171,7 +223,9 @@ public function getContacts() /** * Sets contacts - * @param \SendinBlue\Client\Model\PostContactInfoContacts $contacts + * + * @param \SendinBlue\Client\Model\PostContactInfoContacts $contacts contacts + * * @return $this */ public function setContacts($contacts) @@ -182,7 +236,9 @@ public function setContacts($contacts) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/PostContactInfoContacts.php b/lib/Model/PostContactInfoContacts.php index ce9c71b7..0a2ec936 100644 --- a/lib/Model/PostContactInfoContacts.php +++ b/lib/Model/PostContactInfoContacts.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * PostContactInfoContacts Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class PostContactInfoContacts implements ArrayAccess +class PostContactInfoContacts implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'postContactInfo_contacts'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class PostContactInfoContacts implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class PostContactInfoContacts implements ArrayAccess 'failure' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'failure' => 'failure' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'failure' => 'setFailure' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'failure' => 'getFailure' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +187,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['success'] === null) { - $invalid_properties[] = "'success' can't be null"; + $invalidProperties[] = "'success' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets success + * * @return string[] */ public function getSuccess() @@ -183,7 +229,9 @@ public function getSuccess() /** * Sets success - * @param string[] $success + * + * @param string[] $success success + * * @return $this */ public function setSuccess($success) @@ -195,6 +243,7 @@ public function setSuccess($success) /** * Gets failure + * * @return string[] */ public function getFailure() @@ -204,7 +253,9 @@ public function getFailure() /** * Sets failure - * @param string[] $failure + * + * @param string[] $failure failure + * * @return $this */ public function setFailure($failure) @@ -215,7 +266,9 @@ public function setFailure($failure) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +278,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +307,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +319,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/PostSendFailed.php b/lib/Model/PostSendFailed.php index 517b3944..b0b71f35 100644 --- a/lib/Model/PostSendFailed.php +++ b/lib/Model/PostSendFailed.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * PostSendFailed Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class PostSendFailed implements ArrayAccess +class PostSendFailed implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'postSendFailed'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class PostSendFailed implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class PostSendFailed implements ArrayAccess 'blackListedEmails' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'blackListedEmails' => 'blackListedEmails' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'blackListedEmails' => 'setBlackListedEmails' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,34 +137,63 @@ public static function swaggerFormats() 'blackListedEmails' => 'getBlackListedEmails' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -160,25 +205,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['code'] === null) { - $invalid_properties[] = "'code' can't be null"; + $invalidProperties[] = "'code' can't be null"; } if ($this->container['message'] === null) { - $invalid_properties[] = "'message' can't be null"; + $invalidProperties[] = "'message' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -198,6 +243,7 @@ public function valid() /** * Gets code + * * @return int */ public function getCode() @@ -207,7 +253,9 @@ public function getCode() /** * Sets code + * * @param int $code Response code + * * @return $this */ public function setCode($code) @@ -219,6 +267,7 @@ public function setCode($code) /** * Gets message + * * @return string */ public function getMessage() @@ -228,7 +277,9 @@ public function getMessage() /** * Sets message + * * @param string $message Response message + * * @return $this */ public function setMessage($message) @@ -240,6 +291,7 @@ public function setMessage($message) /** * Gets unexistingEmails + * * @return string[] */ public function getUnexistingEmails() @@ -249,7 +301,9 @@ public function getUnexistingEmails() /** * Sets unexistingEmails - * @param string[] $unexistingEmails + * + * @param string[] $unexistingEmails unexistingEmails + * * @return $this */ public function setUnexistingEmails($unexistingEmails) @@ -261,6 +315,7 @@ public function setUnexistingEmails($unexistingEmails) /** * Gets withoutListEmails + * * @return string[] */ public function getWithoutListEmails() @@ -270,7 +325,9 @@ public function getWithoutListEmails() /** * Sets withoutListEmails - * @param string[] $withoutListEmails + * + * @param string[] $withoutListEmails withoutListEmails + * * @return $this */ public function setWithoutListEmails($withoutListEmails) @@ -282,6 +339,7 @@ public function setWithoutListEmails($withoutListEmails) /** * Gets blackListedEmails + * * @return string[] */ public function getBlackListedEmails() @@ -291,7 +349,9 @@ public function getBlackListedEmails() /** * Sets blackListedEmails - * @param string[] $blackListedEmails + * + * @param string[] $blackListedEmails blackListedEmails + * * @return $this */ public function setBlackListedEmails($blackListedEmails) @@ -302,7 +362,9 @@ public function setBlackListedEmails($blackListedEmails) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -312,7 +374,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -322,8 +386,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -337,7 +403,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -347,15 +415,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/PostSendSmsTestFailed.php b/lib/Model/PostSendSmsTestFailed.php index 73de0839..07ed3ccc 100644 --- a/lib/Model/PostSendSmsTestFailed.php +++ b/lib/Model/PostSendSmsTestFailed.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * PostSendSmsTestFailed Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class PostSendSmsTestFailed implements ArrayAccess +class PostSendSmsTestFailed implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'postSendSmsTestFailed'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -62,6 +65,7 @@ class PostSendSmsTestFailed implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -71,18 +75,30 @@ class PostSendSmsTestFailed implements ArrayAccess 'withoutListSms' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,9 +108,9 @@ public static function swaggerFormats() 'withoutListSms' => 'withoutListSms' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -104,9 +120,9 @@ public static function swaggerFormats() 'withoutListSms' => 'setWithoutListSms' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -116,34 +132,63 @@ public static function swaggerFormats() 'withoutListSms' => 'getWithoutListSms' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -154,25 +199,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['code'] === null) { - $invalid_properties[] = "'code' can't be null"; + $invalidProperties[] = "'code' can't be null"; } if ($this->container['message'] === null) { - $invalid_properties[] = "'message' can't be null"; + $invalidProperties[] = "'message' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -192,6 +237,7 @@ public function valid() /** * Gets code + * * @return int */ public function getCode() @@ -201,7 +247,9 @@ public function getCode() /** * Sets code + * * @param int $code Response code + * * @return $this */ public function setCode($code) @@ -213,6 +261,7 @@ public function setCode($code) /** * Gets message + * * @return string */ public function getMessage() @@ -222,7 +271,9 @@ public function getMessage() /** * Sets message + * * @param string $message Response message + * * @return $this */ public function setMessage($message) @@ -234,6 +285,7 @@ public function setMessage($message) /** * Gets unexistingSms + * * @return string[] */ public function getUnexistingSms() @@ -243,7 +295,9 @@ public function getUnexistingSms() /** * Sets unexistingSms - * @param string[] $unexistingSms + * + * @param string[] $unexistingSms unexistingSms + * * @return $this */ public function setUnexistingSms($unexistingSms) @@ -255,6 +309,7 @@ public function setUnexistingSms($unexistingSms) /** * Gets withoutListSms + * * @return string[] */ public function getWithoutListSms() @@ -264,7 +319,9 @@ public function getWithoutListSms() /** * Sets withoutListSms - * @param string[] $withoutListSms + * + * @param string[] $withoutListSms withoutListSms + * * @return $this */ public function setWithoutListSms($withoutListSms) @@ -275,7 +332,9 @@ public function setWithoutListSms($withoutListSms) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -285,7 +344,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -295,8 +356,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -310,7 +373,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -320,15 +385,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RemainingCreditModel.php b/lib/Model/RemainingCreditModel.php index da686745..95cad1e7 100644 --- a/lib/Model/RemainingCreditModel.php +++ b/lib/Model/RemainingCreditModel.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RemainingCreditModel Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RemainingCreditModel implements ArrayAccess +class RemainingCreditModel implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'remainingCreditModel'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class RemainingCreditModel implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class RemainingCreditModel implements ArrayAccess 'reseller' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'reseller' => 'reseller' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'reseller' => 'setReseller' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'reseller' => 'getReseller' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + if ($this->container['child'] === null) { + $invalidProperties[] = "'child' can't be null"; + } + if ($this->container['reseller'] === null) { + $invalidProperties[] = "'reseller' can't be null"; + } + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,12 +213,19 @@ public function listInvalidProperties() public function valid() { + if ($this->container['child'] === null) { + return false; + } + if ($this->container['reseller'] === null) { + return false; + } return true; } /** * Gets child + * * @return \SendinBlue\Client\Model\RemainingCreditModelChild */ public function getChild() @@ -177,7 +235,9 @@ public function getChild() /** * Sets child - * @param \SendinBlue\Client\Model\RemainingCreditModelChild $child + * + * @param \SendinBlue\Client\Model\RemainingCreditModelChild $child child + * * @return $this */ public function setChild($child) @@ -189,6 +249,7 @@ public function setChild($child) /** * Gets reseller + * * @return \SendinBlue\Client\Model\RemainingCreditModelReseller */ public function getReseller() @@ -198,7 +259,9 @@ public function getReseller() /** * Sets reseller - * @param \SendinBlue\Client\Model\RemainingCreditModelReseller $reseller + * + * @param \SendinBlue\Client\Model\RemainingCreditModelReseller $reseller reseller + * * @return $this */ public function setReseller($reseller) @@ -209,7 +272,9 @@ public function setReseller($reseller) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RemainingCreditModelChild.php b/lib/Model/RemainingCreditModelChild.php index 8cb3926d..088bd9ad 100644 --- a/lib/Model/RemainingCreditModelChild.php +++ b/lib/Model/RemainingCreditModelChild.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RemainingCreditModelChild Class Doc Comment * - * @category Class + * @category Class * @description Credits remaining for child account - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RemainingCreditModelChild implements ArrayAccess +class RemainingCreditModelChild implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'remainingCreditModel_child'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class RemainingCreditModelChild implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -68,18 +72,30 @@ class RemainingCreditModelChild implements ArrayAccess 'email' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -87,9 +103,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -97,9 +113,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -107,34 +123,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -143,25 +188,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['sms'] === null) { - $invalid_properties[] = "'sms' can't be null"; + $invalidProperties[] = "'sms' can't be null"; } if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -181,6 +226,7 @@ public function valid() /** * Gets sms + * * @return int */ public function getSms() @@ -190,7 +236,9 @@ public function getSms() /** * Sets sms + * * @param int $sms SMS Credits remaining for child account + * * @return $this */ public function setSms($sms) @@ -202,6 +250,7 @@ public function setSms($sms) /** * Gets email + * * @return int */ public function getEmail() @@ -211,7 +260,9 @@ public function getEmail() /** * Sets email + * * @param int $email Email Credits remaining for child account + * * @return $this */ public function setEmail($email) @@ -222,7 +273,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -232,7 +285,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -242,8 +297,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -257,7 +314,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -267,15 +326,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RemainingCreditModelReseller.php b/lib/Model/RemainingCreditModelReseller.php index 015bf91f..c6398f90 100644 --- a/lib/Model/RemainingCreditModelReseller.php +++ b/lib/Model/RemainingCreditModelReseller.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RemainingCreditModelReseller Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RemainingCreditModelReseller implements ArrayAccess +class RemainingCreditModelReseller implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'remainingCreditModel_reseller'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class RemainingCreditModelReseller implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class RemainingCreditModelReseller implements ArrayAccess 'email' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['sms'] === null) { - $invalid_properties[] = "'sms' can't be null"; + $invalidProperties[] = "'sms' can't be null"; } if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets sms + * * @return int */ public function getSms() @@ -189,7 +235,9 @@ public function getSms() /** * Sets sms + * * @param int $sms SMS Credits remaining for reseller account + * * @return $this */ public function setSms($sms) @@ -201,6 +249,7 @@ public function setSms($sms) /** * Gets email + * * @return int */ public function getEmail() @@ -210,7 +259,9 @@ public function getEmail() /** * Sets email + * * @param int $email Email Credits remaining for reseller account + * * @return $this */ public function setEmail($email) @@ -221,7 +272,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RemoveContactFromList.php b/lib/Model/RemoveContactFromList.php index 52cb8b79..017371b1 100644 --- a/lib/Model/RemoveContactFromList.php +++ b/lib/Model/RemoveContactFromList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RemoveContactFromList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RemoveContactFromList implements ArrayAccess +class RemoveContactFromList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'removeContactFromList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class RemoveContactFromList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class RemoveContactFromList implements ArrayAccess 'all' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'all' => 'all' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'all' => 'setAll' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'all' => 'getAll' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets emails + * * @return string[] */ public function getEmails() @@ -177,7 +223,9 @@ public function getEmails() /** * Sets emails + * * @param string[] $emails Required if 'all' is false. Emails to remove from a list + * * @return $this */ public function setEmails($emails) @@ -189,6 +237,7 @@ public function setEmails($emails) /** * Gets all + * * @return bool */ public function getAll() @@ -198,7 +247,9 @@ public function getAll() /** * Sets all + * * @param bool $all Required if 'emails' is empty. Remove all existing contacts from a list + * * @return $this */ public function setAll($all) @@ -209,7 +260,9 @@ public function setAll($all) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RemoveCredits.php b/lib/Model/RemoveCredits.php index fee44b18..9f9aaf92 100644 --- a/lib/Model/RemoveCredits.php +++ b/lib/Model/RemoveCredits.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RemoveCredits Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RemoveCredits implements ArrayAccess +class RemoveCredits implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'removeCredits'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class RemoveCredits implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class RemoveCredits implements ArrayAccess 'email' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets sms + * * @return int */ public function getSms() @@ -177,7 +223,9 @@ public function getSms() /** * Sets sms + * * @param int $sms Required if email credits are empty. SMS credits to be removed from the child account + * * @return $this */ public function setSms($sms) @@ -189,6 +237,7 @@ public function setSms($sms) /** * Gets email + * * @return int */ public function getEmail() @@ -198,7 +247,9 @@ public function getEmail() /** * Sets email + * * @param int $email Required if sms credits are empty. Email credits to be removed from the child account + * * @return $this */ public function setEmail($email) @@ -209,7 +260,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RequestContactExport.php b/lib/Model/RequestContactExport.php index f591a4d2..19852197 100644 --- a/lib/Model/RequestContactExport.php +++ b/lib/Model/RequestContactExport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RequestContactExport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RequestContactExport implements ArrayAccess +class RequestContactExport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'requestContactExport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class RequestContactExport implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class RequestContactExport implements ArrayAccess 'notifyUrl' => 'url' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'notifyUrl' => 'notifyUrl' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'notifyUrl' => 'setNotifyUrl' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'notifyUrl' => 'getNotifyUrl' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,22 +193,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['contactFilter'] === null) { - $invalid_properties[] = "'contactFilter' can't be null"; + $invalidProperties[] = "'contactFilter' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets exportAttributes + * * @return string[] */ public function getExportAttributes() @@ -189,7 +235,9 @@ public function getExportAttributes() /** * Sets exportAttributes - * @param string[] $exportAttributes Name of attributes to export. These attributes must be in your contact database + * + * @param string[] $exportAttributes List of all the attributes that you want to export. These attributes must be present in your contact database. For example, ['fname', 'lname', 'email']. + * * @return $this */ public function setExportAttributes($exportAttributes) @@ -201,6 +249,7 @@ public function setExportAttributes($exportAttributes) /** * Gets contactFilter + * * @return object */ public function getContactFilter() @@ -210,7 +259,9 @@ public function getContactFilter() /** * Sets contactFilter - * @param object $contactFilter Filter to apply to the export + * + * @param object $contactFilter Set the filter for the contacts to be exported. For example, {'blacklisted':true} will export all the blacklisted contacts. + * * @return $this */ public function setContactFilter($contactFilter) @@ -222,6 +273,7 @@ public function setContactFilter($contactFilter) /** * Gets notifyUrl + * * @return string */ public function getNotifyUrl() @@ -231,7 +283,9 @@ public function getNotifyUrl() /** * Sets notifyUrl + * * @param string $notifyUrl Webhook that will be called once the export process is finished + * * @return $this */ public function setNotifyUrl($notifyUrl) @@ -242,7 +296,9 @@ public function setNotifyUrl($notifyUrl) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -252,7 +308,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -262,8 +320,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -277,7 +337,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -287,15 +349,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RequestContactImport.php b/lib/Model/RequestContactImport.php index f1e9515e..a7afa5e9 100644 --- a/lib/Model/RequestContactImport.php +++ b/lib/Model/RequestContactImport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RequestContactImport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RequestContactImport implements ArrayAccess +class RequestContactImport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'requestContactImport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -58,11 +61,15 @@ class RequestContactImport implements ArrayAccess 'fileBody' => 'string', 'listIds' => 'int[]', 'notifyUrl' => 'string', - 'newList' => '\SendinBlue\Client\Model\RequestContactImportNewList' + 'newList' => '\SendinBlue\Client\Model\RequestContactImportNewList', + 'emailBlacklist' => 'bool', + 'smsBlacklist' => 'bool', + 'updateExistingContacts' => 'bool' ]; /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -70,21 +77,36 @@ class RequestContactImport implements ArrayAccess 'fileBody' => null, 'listIds' => 'int64', 'notifyUrl' => 'url', - 'newList' => null + 'newList' => null, + 'emailBlacklist' => null, + 'smsBlacklist' => null, + 'updateExistingContacts' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -92,12 +114,15 @@ public static function swaggerFormats() 'fileBody' => 'fileBody', 'listIds' => 'listIds', 'notifyUrl' => 'notifyUrl', - 'newList' => 'newList' + 'newList' => 'newList', + 'emailBlacklist' => 'emailBlacklist', + 'smsBlacklist' => 'smsBlacklist', + 'updateExistingContacts' => 'updateExistingContacts' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -105,12 +130,15 @@ public static function swaggerFormats() 'fileBody' => 'setFileBody', 'listIds' => 'setListIds', 'notifyUrl' => 'setNotifyUrl', - 'newList' => 'setNewList' + 'newList' => 'setNewList', + 'emailBlacklist' => 'setEmailBlacklist', + 'smsBlacklist' => 'setSmsBlacklist', + 'updateExistingContacts' => 'setUpdateExistingContacts' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -118,37 +146,69 @@ public static function swaggerFormats() 'fileBody' => 'getFileBody', 'listIds' => 'getListIds', 'notifyUrl' => 'getNotifyUrl', - 'newList' => 'getNewList' + 'newList' => 'getNewList', + 'emailBlacklist' => 'getEmailBlacklist', + 'smsBlacklist' => 'getSmsBlacklist', + 'updateExistingContacts' => 'getUpdateExistingContacts' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -157,22 +217,25 @@ public function __construct(array $data = null) $this->container['listIds'] = isset($data['listIds']) ? $data['listIds'] : null; $this->container['notifyUrl'] = isset($data['notifyUrl']) ? $data['notifyUrl'] : null; $this->container['newList'] = isset($data['newList']) ? $data['newList'] : null; + $this->container['emailBlacklist'] = isset($data['emailBlacklist']) ? $data['emailBlacklist'] : false; + $this->container['smsBlacklist'] = isset($data['smsBlacklist']) ? $data['smsBlacklist'] : false; + $this->container['updateExistingContacts'] = isset($data['updateExistingContacts']) ? $data['updateExistingContacts'] : true; } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -186,6 +249,7 @@ public function valid() /** * Gets fileUrl + * * @return string */ public function getFileUrl() @@ -195,7 +259,9 @@ public function getFileUrl() /** * Sets fileUrl - * @param string $fileUrl Mandatory if fileBody not defined. URL of the file to be imported (no local file). Possible file types: .txt, .csv + * + * @param string $fileUrl Mandatory if fileBody is not defined. URL of the file to be imported (no local file). Possible file formats: .txt, .csv + * * @return $this */ public function setFileUrl($fileUrl) @@ -207,6 +273,7 @@ public function setFileUrl($fileUrl) /** * Gets fileBody + * * @return string */ public function getFileBody() @@ -216,7 +283,9 @@ public function getFileBody() /** * Sets fileBody + * * @param string $fileBody Mandatory if fileUrl is not defined. CSV content to be imported. Use semicolon to separate multiple attributes + * * @return $this */ public function setFileBody($fileBody) @@ -228,6 +297,7 @@ public function setFileBody($fileBody) /** * Gets listIds + * * @return int[] */ public function getListIds() @@ -237,7 +307,9 @@ public function getListIds() /** * Sets listIds - * @param int[] $listIds Manadatory if newList is not defined. Ids of the lists in which to add the contacts + * + * @param int[] $listIds Mandatory if newList is not defined. Ids of the lists in which the contacts shall be imported. For example, [2, 4, 7]. + * * @return $this */ public function setListIds($listIds) @@ -249,6 +321,7 @@ public function setListIds($listIds) /** * Gets notifyUrl + * * @return string */ public function getNotifyUrl() @@ -258,7 +331,9 @@ public function getNotifyUrl() /** * Sets notifyUrl + * * @param string $notifyUrl URL that will be called once the export process is finished + * * @return $this */ public function setNotifyUrl($notifyUrl) @@ -270,6 +345,7 @@ public function setNotifyUrl($notifyUrl) /** * Gets newList + * * @return \SendinBlue\Client\Model\RequestContactImportNewList */ public function getNewList() @@ -279,7 +355,9 @@ public function getNewList() /** * Sets newList - * @param \SendinBlue\Client\Model\RequestContactImportNewList $newList + * + * @param \SendinBlue\Client\Model\RequestContactImportNewList $newList newList + * * @return $this */ public function setNewList($newList) @@ -288,9 +366,83 @@ public function setNewList($newList) return $this; } + + /** + * Gets emailBlacklist + * + * @return bool + */ + public function getEmailBlacklist() + { + return $this->container['emailBlacklist']; + } + + /** + * Sets emailBlacklist + * + * @param bool $emailBlacklist To blacklist all the contacts for email + * + * @return $this + */ + public function setEmailBlacklist($emailBlacklist) + { + $this->container['emailBlacklist'] = $emailBlacklist; + + return $this; + } + + /** + * Gets smsBlacklist + * + * @return bool + */ + public function getSmsBlacklist() + { + return $this->container['smsBlacklist']; + } + + /** + * Sets smsBlacklist + * + * @param bool $smsBlacklist To blacklist all the contacts for sms + * + * @return $this + */ + public function setSmsBlacklist($smsBlacklist) + { + $this->container['smsBlacklist'] = $smsBlacklist; + + return $this; + } + + /** + * Gets updateExistingContacts + * + * @return bool + */ + public function getUpdateExistingContacts() + { + return $this->container['updateExistingContacts']; + } + + /** + * Sets updateExistingContacts + * + * @param bool $updateExistingContacts To facilitate the choice to update the existing contacts + * + * @return $this + */ + public function setUpdateExistingContacts($updateExistingContacts) + { + $this->container['updateExistingContacts'] = $updateExistingContacts; + + return $this; + } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -300,7 +452,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -310,8 +464,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -325,7 +481,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -335,15 +493,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RequestContactImportNewList.php b/lib/Model/RequestContactImportNewList.php index fc654a2d..ec1ebdae 100644 --- a/lib/Model/RequestContactImportNewList.php +++ b/lib/Model/RequestContactImportNewList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RequestContactImportNewList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description To create a new list and import the contacts into it, pass the listName and an optional folderId. + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RequestContactImportNewList implements ArrayAccess +class RequestContactImportNewList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'requestContactImport_newList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +64,7 @@ class RequestContactImportNewList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +72,30 @@ class RequestContactImportNewList implements ArrayAccess 'folderId' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +103,9 @@ public static function swaggerFormats() 'folderId' => 'folderId' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +113,9 @@ public static function swaggerFormats() 'folderId' => 'setFolderId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +123,63 @@ public static function swaggerFormats() 'folderId' => 'getFolderId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +188,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +214,7 @@ public function valid() /** * Gets listName + * * @return string */ public function getListName() @@ -177,7 +224,9 @@ public function getListName() /** * Sets listName + * * @param string $listName List with listName will be created first and users will be imported in it (Mandatory if listIds is empty). + * * @return $this */ public function setListName($listName) @@ -189,6 +238,7 @@ public function setListName($listName) /** * Gets folderId + * * @return int */ public function getFolderId() @@ -198,7 +248,9 @@ public function getFolderId() /** * Sets folderId - * @param int $folderId Folder id will be used with listName to make newly created list’s desired parent (Mandatory if listName is not empty). + * + * @param int $folderId Id of the folder where this new list shall be created (Mandatory if listName is not empty). + * * @return $this */ public function setFolderId($folderId) @@ -209,7 +261,9 @@ public function setFolderId($folderId) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +273,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +285,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +302,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +314,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/RequestSMSRecipientExport.php b/lib/Model/RequestSMSRecipientExport.php index 1399f5c1..8c909623 100644 --- a/lib/Model/RequestSMSRecipientExport.php +++ b/lib/Model/RequestSMSRecipientExport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * RequestSmsRecipientExport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class RequestSmsRecipientExport implements ArrayAccess +class RequestSmsRecipientExport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'requestSmsRecipientExport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class RequestSmsRecipientExport implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class RequestSmsRecipientExport implements ArrayAccess 'recipientsType' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'recipientsType' => 'recipientsType' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'recipientsType' => 'setRecipientsType' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,21 +122,47 @@ public static function swaggerFormats() 'recipientsType' => 'getRecipientsType' ]; + /** + * 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 RECIPIENTS_TYPE_ALL = 'all'; const RECIPIENTS_TYPE_DELIVERED = 'delivered'; const RECIPIENTS_TYPE_ANSWERED = 'answered'; @@ -132,6 +174,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getRecipientsTypeAllowableValues() @@ -149,13 +192,16 @@ public function getRecipientsTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -164,30 +210,30 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['recipientsType'] === null) { - $invalid_properties[] = "'recipientsType' can't be null"; + $invalidProperties[] = "'recipientsType' can't be null"; } - $allowed_values = $this->getRecipientsTypeAllowableValues(); - if (!in_array($this->container['recipientsType'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getRecipientsTypeAllowableValues(); + if (!in_array($this->container['recipientsType'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'recipientsType', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -198,8 +244,8 @@ public function valid() if ($this->container['recipientsType'] === null) { return false; } - $allowed_values = $this->getRecipientsTypeAllowableValues(); - if (!in_array($this->container['recipientsType'], $allowed_values)) { + $allowedValues = $this->getRecipientsTypeAllowableValues(); + if (!in_array($this->container['recipientsType'], $allowedValues)) { return false; } return true; @@ -208,6 +254,7 @@ public function valid() /** * Gets notifyURL + * * @return string */ public function getNotifyURL() @@ -217,7 +264,9 @@ public function getNotifyURL() /** * Sets notifyURL + * * @param string $notifyURL URL that will be called once the export process is finished + * * @return $this */ public function setNotifyURL($notifyURL) @@ -229,6 +278,7 @@ public function setNotifyURL($notifyURL) /** * Gets recipientsType + * * @return string */ public function getRecipientsType() @@ -238,17 +288,19 @@ public function getRecipientsType() /** * Sets recipientsType + * * @param string $recipientsType Filter the recipients based on how they interacted with the campaign + * * @return $this */ public function setRecipientsType($recipientsType) { - $allowed_values = $this->getRecipientsTypeAllowableValues(); - if (!in_array($recipientsType, $allowed_values)) { + $allowedValues = $this->getRecipientsTypeAllowableValues(); + if (!in_array($recipientsType, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'recipientsType', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -258,7 +310,9 @@ public function setRecipientsType($recipientsType) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -268,7 +322,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -278,8 +334,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -293,7 +351,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -303,15 +363,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendEmail.php b/lib/Model/SendEmail.php index 579918b8..a4d0542f 100644 --- a/lib/Model/SendEmail.php +++ b/lib/Model/SendEmail.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendEmail Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendEmail implements ArrayAccess +class SendEmail implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendEmail'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,12 +63,14 @@ class SendEmail implements ArrayAccess 'replyTo' => 'string', 'attachmentUrl' => 'string', 'attachment' => '\SendinBlue\Client\Model\SendEmailAttachment[]', - 'headers' => 'map[string,string]', - 'attributes' => 'map[string,string]' + 'headers' => 'object', + 'attributes' => 'object', + 'tags' => 'string[]' ]; /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -76,21 +81,34 @@ class SendEmail implements ArrayAccess 'attachmentUrl' => 'url', 'attachment' => null, 'headers' => null, - 'attributes' => null + 'attributes' => null, + 'tags' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -101,12 +119,13 @@ public static function swaggerFormats() 'attachmentUrl' => 'attachmentUrl', 'attachment' => 'attachment', 'headers' => 'headers', - 'attributes' => 'attributes' + 'attributes' => 'attributes', + 'tags' => 'tags' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -117,12 +136,13 @@ public static function swaggerFormats() 'attachmentUrl' => 'setAttachmentUrl', 'attachment' => 'setAttachment', 'headers' => 'setHeaders', - 'attributes' => 'setAttributes' + 'attributes' => 'setAttributes', + 'tags' => 'setTags' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -133,37 +153,67 @@ public static function swaggerFormats() 'attachmentUrl' => 'getAttachmentUrl', 'attachment' => 'getAttachment', 'headers' => 'getHeaders', - 'attributes' => 'getAttributes' + 'attributes' => 'getAttributes', + 'tags' => 'getTags' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -175,25 +225,26 @@ public function __construct(array $data = null) $this->container['attachment'] = isset($data['attachment']) ? $data['attachment'] : null; $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; $this->container['attributes'] = isset($data['attributes']) ? $data['attributes'] : null; + $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['emailTo'] === null) { - $invalid_properties[] = "'emailTo' can't be null"; + $invalidProperties[] = "'emailTo' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -210,6 +261,7 @@ public function valid() /** * Gets emailTo + * * @return string[] */ public function getEmailTo() @@ -219,7 +271,9 @@ public function getEmailTo() /** * Sets emailTo - * @param string[] $emailTo Email addresses of the recipients + * + * @param string[] $emailTo List of the email addresses of the recipients. For example, ['abc@example.com', 'asd@example.com']. + * * @return $this */ public function setEmailTo($emailTo) @@ -231,6 +285,7 @@ public function setEmailTo($emailTo) /** * Gets emailBcc + * * @return string[] */ public function getEmailBcc() @@ -240,7 +295,9 @@ public function getEmailBcc() /** * Sets emailBcc - * @param string[] $emailBcc Email addresses of the recipients in bcc + * + * @param string[] $emailBcc List of the email addresses of the recipients in bcc + * * @return $this */ public function setEmailBcc($emailBcc) @@ -252,6 +309,7 @@ public function setEmailBcc($emailBcc) /** * Gets emailCc + * * @return string[] */ public function getEmailCc() @@ -261,7 +319,9 @@ public function getEmailCc() /** * Sets emailCc - * @param string[] $emailCc Email addresses of the recipients in cc + * + * @param string[] $emailCc List of the email addresses of the recipients in cc + * * @return $this */ public function setEmailCc($emailCc) @@ -273,6 +333,7 @@ public function setEmailCc($emailCc) /** * Gets replyTo + * * @return string */ public function getReplyTo() @@ -282,7 +343,9 @@ public function getReplyTo() /** * Sets replyTo - * @param string $replyTo Email on which campaign recipients will be able to reply to + * + * @param string $replyTo Email address which shall be used by campaign recipients to reply back + * * @return $this */ public function setReplyTo($replyTo) @@ -294,6 +357,7 @@ public function setReplyTo($replyTo) /** * Gets attachmentUrl + * * @return string */ public function getAttachmentUrl() @@ -303,7 +367,9 @@ public function getAttachmentUrl() /** * Sets attachmentUrl + * * @param string $attachmentUrl Absolute url of the attachment (no local file). Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps + * * @return $this */ public function setAttachmentUrl($attachmentUrl) @@ -315,6 +381,7 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets attachment + * * @return \SendinBlue\Client\Model\SendEmailAttachment[] */ public function getAttachment() @@ -324,7 +391,9 @@ public function getAttachment() /** * Sets attachment - * @param \SendinBlue\Client\Model\SendEmailAttachment[] $attachment Pass the base64 content of the attachment. Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps + * + * @param \SendinBlue\Client\Model\SendEmailAttachment[] $attachment Pass the list of content (base64 encoded) and name of the attachment. For example, [{'content':'base64 encoded content 1', 'name':'attcahment1'}, {'content':'base64 encoded content 2', 'name':'attcahment2'}]. + * * @return $this */ public function setAttachment($attachment) @@ -336,7 +405,8 @@ public function setAttachment($attachment) /** * Gets headers - * @return map[string,string] + * + * @return object */ public function getHeaders() { @@ -345,7 +415,9 @@ public function getHeaders() /** * Sets headers - * @param map[string,string] $headers + * + * @param object $headers Pass the set of headers that shall be sent along the mail headers in the original email. 'X-Mailin-IP' header can be set (only for dedicated ip users) to mention the IP to be used for sending transactional emails. For example, {'Content-Type':'text/html', 'charset':'iso-8859-1', 'X-Mailin-IP':'1.2.3.4'} + * * @return $this */ public function setHeaders($headers) @@ -357,7 +429,8 @@ public function setHeaders($headers) /** * Gets attributes - * @return map[string,string] + * + * @return object */ public function getAttributes() { @@ -366,7 +439,9 @@ public function getAttributes() /** * Sets attributes - * @param map[string,string] $attributes + * + * @param object $attributes Pass the set of attributes to customize the template. For example, {'FNAME':'Joe', 'LNAME':'Doe'} + * * @return $this */ public function setAttributes($attributes) @@ -375,9 +450,35 @@ public function setAttributes($attributes) return $this; } + + /** + * Gets tags + * + * @return string[] + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[] $tags Tag your emails to find them more easily + * + * @return $this + */ + public function setTags($tags) + { + $this->container['tags'] = $tags; + + return $this; + } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -387,7 +488,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -397,8 +500,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -412,7 +517,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -422,15 +529,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendEmailAttachment.php b/lib/Model/SendEmailAttachment.php index 0ba52cb5..a36e8ef2 100644 --- a/lib/Model/SendEmailAttachment.php +++ b/lib/Model/SendEmailAttachment.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendEmailAttachment Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendEmailAttachment implements ArrayAccess +class SendEmailAttachment implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendEmail_attachment'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class SendEmailAttachment implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class SendEmailAttachment implements ArrayAccess 'name' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'name' => 'name' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'name' => 'setName' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'name' => 'getName' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,23 +187,29 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - if (!is_null($this->container['content']) && !preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $this->container['content'])) { - $invalid_properties[] = "invalid value for 'content', must be conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."; + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $this->container['content'])) { + $invalidProperties[] = "invalid value for 'content', must be conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."; } - return $invalid_properties; + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -166,15 +217,22 @@ public function listInvalidProperties() public function valid() { + if ($this->container['content'] === null) { + return false; + } if (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $this->container['content'])) { return false; } + if ($this->container['name'] === null) { + return false; + } return true; } /** * Gets content + * * @return string */ public function getContent() @@ -184,13 +242,15 @@ public function getContent() /** * Sets content + * * @param string $content Base64 encoded chunk data of the attachment generated on the fly + * * @return $this */ public function setContent($content) { - if (!is_null($content) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $content))) { + if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $content))) { throw new \InvalidArgumentException("invalid value for $content when calling SendEmailAttachment., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); } @@ -201,6 +261,7 @@ public function setContent($content) /** * Gets name + * * @return string */ public function getName() @@ -210,7 +271,9 @@ public function getName() /** * Sets name + * * @param string $name Required for content. Name of the attachment + * * @return $this */ public function setName($name) @@ -221,7 +284,9 @@ public function setName($name) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +296,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +308,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +325,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +337,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendReport.php b/lib/Model/SendReport.php index 8aa208cb..73f77c29 100644 --- a/lib/Model/SendReport.php +++ b/lib/Model/SendReport.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendReport Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendReport implements ArrayAccess +class SendReport implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendReport'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class SendReport implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class SendReport implements ArrayAccess 'email' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,21 +122,47 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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 LANGUAGE_FR = 'fr'; const LANGUAGE_ES = 'es'; const LANGUAGE_PT = 'pt'; @@ -132,6 +174,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getLanguageAllowableValues() @@ -149,13 +192,16 @@ public function getLanguageAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -164,27 +210,30 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - $allowed_values = $this->getLanguageAllowableValues(); - if (!in_array($this->container['language'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($this->container['language'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'language', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -192,8 +241,11 @@ public function listInvalidProperties() public function valid() { - $allowed_values = $this->getLanguageAllowableValues(); - if (!in_array($this->container['language'], $allowed_values)) { + $allowedValues = $this->getLanguageAllowableValues(); + if (!in_array($this->container['language'], $allowedValues)) { + return false; + } + if ($this->container['email'] === null) { return false; } return true; @@ -202,6 +254,7 @@ public function valid() /** * Gets language + * * @return string */ public function getLanguage() @@ -211,17 +264,19 @@ public function getLanguage() /** * Sets language + * * @param string $language Language of email content for campaign report sending. + * * @return $this */ public function setLanguage($language) { - $allowed_values = $this->getLanguageAllowableValues(); - if (!is_null($language) && !in_array($language, $allowed_values)) { + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($language) && !in_array($language, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'language', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -232,6 +287,7 @@ public function setLanguage($language) /** * Gets email + * * @return \SendinBlue\Client\Model\SendReportEmail */ public function getEmail() @@ -241,7 +297,9 @@ public function getEmail() /** * Sets email - * @param \SendinBlue\Client\Model\SendReportEmail $email + * + * @param \SendinBlue\Client\Model\SendReportEmail $email email + * * @return $this */ public function setEmail($email) @@ -252,7 +310,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -262,7 +322,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -272,8 +334,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -287,7 +351,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -297,15 +363,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendReportEmail.php b/lib/Model/SendReportEmail.php index 40ebbf71..c8f6f1e0 100644 --- a/lib/Model/SendReportEmail.php +++ b/lib/Model/SendReportEmail.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendReportEmail Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description Email sending credentials including subject, body, to, cc etc. + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendReportEmail implements ArrayAccess +class SendReportEmail implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendReport_email'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -64,6 +68,7 @@ class SendReportEmail implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -75,18 +80,30 @@ class SendReportEmail implements ArrayAccess 'body' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -98,9 +115,9 @@ public static function swaggerFormats() 'body' => 'body' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -112,9 +129,9 @@ public static function swaggerFormats() 'body' => 'setBody' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -126,21 +143,47 @@ public static function swaggerFormats() 'body' => 'getBody' ]; + /** + * 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 CONTENT_TYPE_TEXT = 'text'; const CONTENT_TYPE_HTML = 'html'; @@ -148,6 +191,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getContentTypeAllowableValues() @@ -161,13 +205,16 @@ public function getContentTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -180,27 +227,27 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - $allowed_values = $this->getContentTypeAllowableValues(); - if (!in_array($this->container['contentType'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getContentTypeAllowableValues(); + if (!in_array($this->container['contentType'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'contentType', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -208,8 +255,8 @@ public function listInvalidProperties() public function valid() { - $allowed_values = $this->getContentTypeAllowableValues(); - if (!in_array($this->container['contentType'], $allowed_values)) { + $allowedValues = $this->getContentTypeAllowableValues(); + if (!in_array($this->container['contentType'], $allowedValues)) { return false; } return true; @@ -218,6 +265,7 @@ public function valid() /** * Gets subject + * * @return string */ public function getSubject() @@ -227,7 +275,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the email message + * * @return $this */ public function setSubject($subject) @@ -239,6 +289,7 @@ public function setSubject($subject) /** * Gets to + * * @return string[] */ public function getTo() @@ -248,7 +299,9 @@ public function getTo() /** * Sets to + * * @param string[] $to Email addresses of the recipients + * * @return $this */ public function setTo($to) @@ -260,6 +313,7 @@ public function setTo($to) /** * Gets contentType + * * @return string */ public function getContentType() @@ -269,17 +323,19 @@ public function getContentType() /** * Sets contentType + * * @param string $contentType Type of the message body + * * @return $this */ public function setContentType($contentType) { - $allowed_values = $this->getContentTypeAllowableValues(); - if (!is_null($contentType) && !in_array($contentType, $allowed_values)) { + $allowedValues = $this->getContentTypeAllowableValues(); + if (!is_null($contentType) && !in_array($contentType, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'contentType', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -290,6 +346,7 @@ public function setContentType($contentType) /** * Gets bcc + * * @return string[] */ public function getBcc() @@ -299,7 +356,9 @@ public function getBcc() /** * Sets bcc + * * @param string[] $bcc Email addresses of the recipients in bcc + * * @return $this */ public function setBcc($bcc) @@ -311,6 +370,7 @@ public function setBcc($bcc) /** * Gets cc + * * @return string[] */ public function getCc() @@ -320,7 +380,9 @@ public function getCc() /** * Sets cc + * * @param string[] $cc Email addresses of the recipients in cc + * * @return $this */ public function setCc($cc) @@ -332,6 +394,7 @@ public function setCc($cc) /** * Gets body + * * @return string */ public function getBody() @@ -341,7 +404,9 @@ public function getBody() /** * Sets body + * * @param string $body Body of the email message + * * @return $this */ public function setBody($body) @@ -352,7 +417,9 @@ public function setBody($body) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -362,7 +429,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -372,8 +441,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -387,7 +458,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -397,15 +470,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendSms.php b/lib/Model/SendSms.php index e25a9937..49d3f3b2 100644 --- a/lib/Model/SendSms.php +++ b/lib/Model/SendSms.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendSms Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendSms implements ArrayAccess +class SendSms implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendSms'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class SendSms implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class SendSms implements ArrayAccess 'messageId' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'messageId' => 'messageId' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'messageId' => 'setMessageId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'messageId' => 'getMessageId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['reference'] === null) { - $invalid_properties[] = "'reference' can't be null"; + $invalidProperties[] = "'reference' can't be null"; } if ($this->container['messageId'] === null) { - $invalid_properties[] = "'messageId' can't be null"; + $invalidProperties[] = "'messageId' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets reference + * * @return string */ public function getReference() @@ -189,7 +235,9 @@ public function getReference() /** * Sets reference - * @param string $reference + * + * @param string $reference reference + * * @return $this */ public function setReference($reference) @@ -201,6 +249,7 @@ public function setReference($reference) /** * Gets messageId + * * @return int */ public function getMessageId() @@ -210,7 +259,9 @@ public function getMessageId() /** * Sets messageId - * @param int $messageId + * + * @param int $messageId messageId + * * @return $this */ public function setMessageId($messageId) @@ -221,7 +272,9 @@ public function setMessageId($messageId) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendSmtpEmail.php b/lib/Model/SendSmtpEmail.php index 0b2805a3..4eb67813 100644 --- a/lib/Model/SendSmtpEmail.php +++ b/lib/Model/SendSmtpEmail.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendSmtpEmail Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendSmtpEmail implements ArrayAccess +class SendSmtpEmail implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendSmtpEmail'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,13 +66,15 @@ class SendSmtpEmail implements ArrayAccess 'subject' => 'string', 'replyTo' => '\SendinBlue\Client\Model\SendSmtpEmailReplyTo', 'attachment' => '\SendinBlue\Client\Model\SendSmtpEmailAttachment[]', - 'headers' => 'map[string,string]', + 'headers' => 'object', 'templateId' => 'int', - 'params' => 'map[string,string]' + 'params' => 'object', + 'tags' => 'string[]' ]; /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -84,21 +89,34 @@ class SendSmtpEmail implements ArrayAccess 'attachment' => null, 'headers' => null, 'templateId' => 'int64', - 'params' => null + 'params' => null, + 'tags' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -113,12 +131,13 @@ public static function swaggerFormats() 'attachment' => 'attachment', 'headers' => 'headers', 'templateId' => 'templateId', - 'params' => 'params' + 'params' => 'params', + 'tags' => 'tags' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -133,12 +152,13 @@ public static function swaggerFormats() 'attachment' => 'setAttachment', 'headers' => 'setHeaders', 'templateId' => 'setTemplateId', - 'params' => 'setParams' + 'params' => 'setParams', + 'tags' => 'setTags' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -153,37 +173,67 @@ public static function swaggerFormats() 'attachment' => 'getAttachment', 'headers' => 'getHeaders', 'templateId' => 'getTemplateId', - 'params' => 'getParams' + 'params' => 'getParams', + 'tags' => 'getTags' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -199,25 +249,26 @@ public function __construct(array $data = null) $this->container['headers'] = isset($data['headers']) ? $data['headers'] : null; $this->container['templateId'] = isset($data['templateId']) ? $data['templateId'] : null; $this->container['params'] = isset($data['params']) ? $data['params'] : null; + $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['to'] === null) { - $invalid_properties[] = "'to' can't be null"; + $invalidProperties[] = "'to' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -234,6 +285,7 @@ public function valid() /** * Gets sender + * * @return \SendinBlue\Client\Model\SendSmtpEmailSender */ public function getSender() @@ -243,7 +295,9 @@ public function getSender() /** * Sets sender - * @param \SendinBlue\Client\Model\SendSmtpEmailSender $sender + * + * @param \SendinBlue\Client\Model\SendSmtpEmailSender $sender sender + * * @return $this */ public function setSender($sender) @@ -255,6 +309,7 @@ public function setSender($sender) /** * Gets to + * * @return \SendinBlue\Client\Model\SendSmtpEmailTo[] */ public function getTo() @@ -264,7 +319,9 @@ public function getTo() /** * Sets to - * @param \SendinBlue\Client\Model\SendSmtpEmailTo[] $to Email addresses and names of the recipients + * + * @param \SendinBlue\Client\Model\SendSmtpEmailTo[] $to List of email addresses and names (optional) of the recipients. For example, [{'name':'Jimmy', 'email':'jimmy98@example.com'}, {'name':'Joe', 'email':'joe@example.com'}] + * * @return $this */ public function setTo($to) @@ -276,6 +333,7 @@ public function setTo($to) /** * Gets bcc + * * @return \SendinBlue\Client\Model\SendSmtpEmailBcc[] */ public function getBcc() @@ -285,7 +343,9 @@ public function getBcc() /** * Sets bcc - * @param \SendinBlue\Client\Model\SendSmtpEmailBcc[] $bcc Email addresses and names of the recipients in bcc + * + * @param \SendinBlue\Client\Model\SendSmtpEmailBcc[] $bcc List of email addresses and names (optional) of the recipients in bcc + * * @return $this */ public function setBcc($bcc) @@ -297,6 +357,7 @@ public function setBcc($bcc) /** * Gets cc + * * @return \SendinBlue\Client\Model\SendSmtpEmailCc[] */ public function getCc() @@ -306,7 +367,9 @@ public function getCc() /** * Sets cc - * @param \SendinBlue\Client\Model\SendSmtpEmailCc[] $cc Email addresses and names of the recipients in cc + * + * @param \SendinBlue\Client\Model\SendSmtpEmailCc[] $cc List of email addresses and names (optional) of the recipients in cc + * * @return $this */ public function setCc($cc) @@ -318,6 +381,7 @@ public function setCc($cc) /** * Gets htmlContent + * * @return string */ public function getHtmlContent() @@ -327,7 +391,9 @@ public function getHtmlContent() /** * Sets htmlContent + * * @param string $htmlContent HTML body of the message ( Mandatory if 'templateId' is not passed, ignored if 'templateId' is passed ) + * * @return $this */ public function setHtmlContent($htmlContent) @@ -339,6 +405,7 @@ public function setHtmlContent($htmlContent) /** * Gets textContent + * * @return string */ public function getTextContent() @@ -348,7 +415,9 @@ public function getTextContent() /** * Sets textContent + * * @param string $textContent Plain Text body of the message ( Ignored if 'templateId' is passed ) + * * @return $this */ public function setTextContent($textContent) @@ -360,6 +429,7 @@ public function setTextContent($textContent) /** * Gets subject + * * @return string */ public function getSubject() @@ -369,7 +439,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the message. Mandatory if 'templateId' is not passed + * * @return $this */ public function setSubject($subject) @@ -381,6 +453,7 @@ public function setSubject($subject) /** * Gets replyTo + * * @return \SendinBlue\Client\Model\SendSmtpEmailReplyTo */ public function getReplyTo() @@ -390,7 +463,9 @@ public function getReplyTo() /** * Sets replyTo - * @param \SendinBlue\Client\Model\SendSmtpEmailReplyTo $replyTo + * + * @param \SendinBlue\Client\Model\SendSmtpEmailReplyTo $replyTo replyTo + * * @return $this */ public function setReplyTo($replyTo) @@ -402,6 +477,7 @@ public function setReplyTo($replyTo) /** * Gets attachment + * * @return \SendinBlue\Client\Model\SendSmtpEmailAttachment[] */ public function getAttachment() @@ -411,7 +487,9 @@ public function getAttachment() /** * Sets attachment - * @param \SendinBlue\Client\Model\SendSmtpEmailAttachment[] $attachment Pass the absolute URL (no local file) or the base64 content of the attachment. Name can be used in both cases to define the attachment name. It is mandatory in case of content. Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps ( Ignored if 'templateId' is passed ) + * + * @param \SendinBlue\Client\Model\SendSmtpEmailAttachment[] $attachment Pass the absolute URL (no local file) or the base64 content of the attachment along with the attachment name (Mandatory if attachment content is passed). For example, [{'url':'https://attachment.domain.com/myAttachmentFromUrl.jpg', 'name':'My attachment 1'}, {'content':'base64 exmaple content', 'name':'My attachment 2'}]. Allowed extensions for attachment file: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps ( Ignored if 'templateId' is passed ) + * * @return $this */ public function setAttachment($attachment) @@ -423,7 +501,8 @@ public function setAttachment($attachment) /** * Gets headers - * @return map[string,string] + * + * @return object */ public function getHeaders() { @@ -432,7 +511,9 @@ public function getHeaders() /** * Sets headers - * @param map[string,string] $headers + * + * @param object $headers Pass the set of headers that shall be sent along the mail headers in the original email. 'X-Mailin-IP' header can be set (only for dedicated ip users) to mention the IP to be used for sending transactional emails. For example, {'Content-Type':'text/html', 'charset':'iso-8859-1', 'X-Mailin-IP':'1.2.3.4'} + * * @return $this */ public function setHeaders($headers) @@ -444,6 +525,7 @@ public function setHeaders($headers) /** * Gets templateId + * * @return int */ public function getTemplateId() @@ -453,7 +535,9 @@ public function getTemplateId() /** * Sets templateId + * * @param int $templateId Id of the template + * * @return $this */ public function setTemplateId($templateId) @@ -465,7 +549,8 @@ public function setTemplateId($templateId) /** * Gets params - * @return map[string,string] + * + * @return object */ public function getParams() { @@ -474,7 +559,9 @@ public function getParams() /** * Sets params - * @param map[string,string] $params + * + * @param object $params Pass the set of attributes to customize the template. For example, {'FNAME':'Joe', 'LNAME':'Doe'}. + * * @return $this */ public function setParams($params) @@ -483,9 +570,35 @@ public function setParams($params) return $this; } + + /** + * Gets tags + * + * @return string[] + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[] $tags Tag your emails to find them more easily + * + * @return $this + */ + public function setTags($tags) + { + $this->container['tags'] = $tags; + + return $this; + } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -495,7 +608,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -505,8 +620,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -520,7 +637,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -530,15 +649,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendSmtpEmailAttachment.php b/lib/Model/SendSmtpEmailAttachment.php index a6321fa9..48909d12 100644 --- a/lib/Model/SendSmtpEmailAttachment.php +++ b/lib/Model/SendSmtpEmailAttachment.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendSmtpEmailAttachment Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendSmtpEmailAttachment implements ArrayAccess +class SendSmtpEmailAttachment implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendSmtpEmail_attachment'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class SendSmtpEmailAttachment implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class SendSmtpEmailAttachment implements ArrayAccess 'name' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'name' => 'name' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'name' => 'setName' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'name' => 'getName' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,23 +193,23 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if (!is_null($this->container['content']) && !preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $this->container['content'])) { - $invalid_properties[] = "invalid value for 'content', must be conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."; + $invalidProperties[] = "invalid value for 'content', must be conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -181,6 +226,7 @@ public function valid() /** * Gets url + * * @return string */ public function getUrl() @@ -190,7 +236,9 @@ public function getUrl() /** * Sets url + * * @param string $url Absolute url of the attachment (no local file). + * * @return $this */ public function setUrl($url) @@ -202,6 +250,7 @@ public function setUrl($url) /** * Gets content + * * @return string */ public function getContent() @@ -211,7 +260,9 @@ public function getContent() /** * Sets content + * * @param string $content Base64 encoded chunk data of the attachment generated on the fly + * * @return $this */ public function setContent($content) @@ -228,6 +279,7 @@ public function setContent($content) /** * Gets name + * * @return string */ public function getName() @@ -237,7 +289,9 @@ public function getName() /** * Sets name - * @param string $name Required for content. Name of the attachment + * + * @param string $name Required if content is passed. Name of the attachment + * * @return $this */ public function setName($name) @@ -248,7 +302,9 @@ public function setName($name) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -258,7 +314,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -268,8 +326,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -283,7 +343,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -293,15 +355,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendSmtpEmailBcc.php b/lib/Model/SendSmtpEmailBcc.php index 61f2b411..50d5a205 100644 --- a/lib/Model/SendSmtpEmailBcc.php +++ b/lib/Model/SendSmtpEmailBcc.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendSmtpEmailBcc Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendSmtpEmailBcc implements ArrayAccess +class SendSmtpEmailBcc implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendSmtpEmail_bcc'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class SendSmtpEmailBcc implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class SendSmtpEmailBcc implements ArrayAccess 'name' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'name' => 'name' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'name' => 'setName' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'name' => 'getName' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +187,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -183,7 +229,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email address of the recipient in bcc + * * @return $this */ public function setEmail($email) @@ -195,6 +243,7 @@ public function setEmail($email) /** * Gets name + * * @return string */ public function getName() @@ -204,7 +253,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the recipient in bcc + * * @return $this */ public function setName($name) @@ -215,7 +266,9 @@ public function setName($name) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +278,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +307,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +319,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendSmtpEmailCc.php b/lib/Model/SendSmtpEmailCc.php index 0ef22709..c73cc01d 100644 --- a/lib/Model/SendSmtpEmailCc.php +++ b/lib/Model/SendSmtpEmailCc.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendSmtpEmailCc Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendSmtpEmailCc implements ArrayAccess +class SendSmtpEmailCc implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendSmtpEmail_cc'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class SendSmtpEmailCc implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class SendSmtpEmailCc implements ArrayAccess 'name' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'name' => 'name' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'name' => 'setName' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'name' => 'getName' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +187,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -183,7 +229,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email address of the recipient in cc + * * @return $this */ public function setEmail($email) @@ -195,6 +243,7 @@ public function setEmail($email) /** * Gets name + * * @return string */ public function getName() @@ -204,7 +253,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the recipient in cc + * * @return $this */ public function setName($name) @@ -215,7 +266,9 @@ public function setName($name) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +278,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +307,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +319,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendSmtpEmailReplyTo.php b/lib/Model/SendSmtpEmailReplyTo.php index f0ee2167..bc537c23 100644 --- a/lib/Model/SendSmtpEmailReplyTo.php +++ b/lib/Model/SendSmtpEmailReplyTo.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendSmtpEmailReplyTo Class Doc Comment * - * @category Class - * @description Email on which transactional mail recipients will be able to reply to - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description Email (required), along with name (optional), on which transactional mail recipients will be able to reply back. For example, {'email':'ann6533@example.com', 'name':'Ann'}. + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendSmtpEmailReplyTo implements ArrayAccess +class SendSmtpEmailReplyTo implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendSmtpEmail_replyTo'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class SendSmtpEmailReplyTo implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -68,18 +72,30 @@ class SendSmtpEmailReplyTo implements ArrayAccess 'name' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -87,9 +103,9 @@ public static function swaggerFormats() 'name' => 'name' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -97,9 +113,9 @@ public static function swaggerFormats() 'name' => 'setName' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -107,34 +123,63 @@ public static function swaggerFormats() 'name' => 'getName' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -143,22 +188,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -175,6 +220,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -184,7 +230,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email address in reply to + * * @return $this */ public function setEmail($email) @@ -196,6 +244,7 @@ public function setEmail($email) /** * Gets name + * * @return string */ public function getName() @@ -205,7 +254,9 @@ public function getName() /** * Sets name + * * @param string $name Name in reply to + * * @return $this */ public function setName($name) @@ -216,7 +267,9 @@ public function setName($name) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -226,7 +279,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -236,8 +291,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -251,7 +308,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -261,15 +320,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendSmtpEmailSender.php b/lib/Model/SendSmtpEmailSender.php index a305912d..61be8fea 100644 --- a/lib/Model/SendSmtpEmailSender.php +++ b/lib/Model/SendSmtpEmailSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendSmtpEmailSender Class Doc Comment * - * @category Class - * @description Sender from which emails are sent. Mandatory if 'templateId' is not passed - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description Mandatory if 'templateId' is not passed. Pass name (optional) and email of sender from which emails will be sent. For example, {'name':'Mary from MyShop', 'email':'no-reply@myshop.com'} + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendSmtpEmailSender implements ArrayAccess +class SendSmtpEmailSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendSmtpEmail_sender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class SendSmtpEmailSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -68,18 +72,30 @@ class SendSmtpEmailSender implements ArrayAccess 'email' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -87,9 +103,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -97,9 +113,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -107,34 +123,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -143,22 +188,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -175,6 +220,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -184,7 +230,9 @@ public function getName() /** * Sets name - * @param string $name Sender Name from which the emails are sent + * + * @param string $name Name of the sender from which the emails will be sent + * * @return $this */ public function setName($name) @@ -196,6 +244,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -205,7 +254,9 @@ public function getEmail() /** * Sets email - * @param string $email Sender Email from which the emails are sent + * + * @param string $email Email of the sender from which the emails will be sent + * * @return $this */ public function setEmail($email) @@ -216,7 +267,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -226,7 +279,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -236,8 +291,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -251,7 +308,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -261,15 +320,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendSmtpEmailTo.php b/lib/Model/SendSmtpEmailTo.php index c9b62240..eec8a18d 100644 --- a/lib/Model/SendSmtpEmailTo.php +++ b/lib/Model/SendSmtpEmailTo.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendSmtpEmailTo Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendSmtpEmailTo implements ArrayAccess +class SendSmtpEmailTo implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendSmtpEmail_to'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class SendSmtpEmailTo implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class SendSmtpEmailTo implements ArrayAccess 'name' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'name' => 'name' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'name' => 'setName' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'name' => 'getName' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,22 +187,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['email'] === null) { - $invalid_properties[] = "'email' can't be null"; + $invalidProperties[] = "'email' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -183,7 +229,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email address of the recipient + * * @return $this */ public function setEmail($email) @@ -195,6 +243,7 @@ public function setEmail($email) /** * Gets name + * * @return string */ public function getName() @@ -204,7 +253,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the recipient + * * @return $this */ public function setName($name) @@ -215,7 +266,9 @@ public function setName($name) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -225,7 +278,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -235,8 +290,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -250,7 +307,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -260,15 +319,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendTemplateEmail.php b/lib/Model/SendTemplateEmail.php index 5b6591fb..7dac2431 100644 --- a/lib/Model/SendTemplateEmail.php +++ b/lib/Model/SendTemplateEmail.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendTemplateEmail Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendTemplateEmail implements ArrayAccess +class SendTemplateEmail implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendTemplateEmail'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class SendTemplateEmail implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'messageId' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'messageId' => 'messageId' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'messageId' => 'setMessageId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'messageId' => 'getMessageId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,22 +181,22 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['messageId'] === null) { - $invalid_properties[] = "'messageId' can't be null"; + $invalidProperties[] = "'messageId' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets messageId + * * @return string */ public function getMessageId() @@ -177,7 +223,9 @@ public function getMessageId() /** * Sets messageId + * * @param string $messageId Message ID of the template Email sent + * * @return $this */ public function setMessageId($messageId) @@ -188,7 +236,9 @@ public function setMessageId($messageId) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -198,7 +248,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -208,8 +260,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -223,7 +277,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -233,15 +289,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendTestEmail.php b/lib/Model/SendTestEmail.php index dd016f74..4131759a 100644 --- a/lib/Model/SendTestEmail.php +++ b/lib/Model/SendTestEmail.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendTestEmail Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendTestEmail implements ArrayAccess +class SendTestEmail implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendTestEmail'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class SendTestEmail implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'emailTo' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'emailTo' => 'emailTo' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'emailTo' => 'setEmailTo' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'emailTo' => 'getEmailTo' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets emailTo + * * @return string[] */ public function getEmailTo() @@ -171,7 +217,9 @@ public function getEmailTo() /** * Sets emailTo - * @param string[] $emailTo If empty the test email will be sent to your entire test list. Use this field to send it to specific addresses in your list. + * + * @param string[] $emailTo List of the email addresses of the recipients whom you wish to send the test mail. If left empty, the test mail will be sent to your entire test list. + * * @return $this */ public function setEmailTo($emailTo) @@ -182,7 +230,9 @@ public function setEmailTo($emailTo) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendTestSms.php b/lib/Model/SendTestSms.php index 537acada..487118ab 100644 --- a/lib/Model/SendTestSms.php +++ b/lib/Model/SendTestSms.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendTestSms Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendTestSms implements ArrayAccess +class SendTestSms implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendTestSms'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -59,76 +62,118 @@ class SendTestSms implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'phoneNumbers' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'phoneNumbers' => 'phoneNumbers' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'phoneNumbers' => 'setPhoneNumbers' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'phoneNumbers' => 'getPhoneNumbers' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -136,19 +181,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -162,6 +207,7 @@ public function valid() /** * Gets phoneNumbers + * * @return string[] */ public function getPhoneNumbers() @@ -171,7 +217,9 @@ public function getPhoneNumbers() /** * Sets phoneNumbers + * * @param string[] $phoneNumbers Mobile number with the country code to send test SMS. The mobile number defined here must belong to one of your contacts in SendinBlue account and must not be blacklisted + * * @return $this */ public function setPhoneNumbers($phoneNumbers) @@ -182,7 +230,9 @@ public function setPhoneNumbers($phoneNumbers) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -192,7 +242,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -202,8 +254,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -217,7 +271,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -227,15 +283,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/SendTransacSms.php b/lib/Model/SendTransacSms.php index f0d3032f..cd07c0bb 100644 --- a/lib/Model/SendTransacSms.php +++ b/lib/Model/SendTransacSms.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * SendTransacSms Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class SendTransacSms implements ArrayAccess +class SendTransacSms implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'sendTransacSms'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -64,6 +67,7 @@ class SendTransacSms implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -75,18 +79,30 @@ class SendTransacSms implements ArrayAccess 'webUrl' => 'url' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -98,9 +114,9 @@ public static function swaggerFormats() 'webUrl' => 'webUrl' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -112,9 +128,9 @@ public static function swaggerFormats() 'webUrl' => 'setWebUrl' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -126,21 +142,47 @@ public static function swaggerFormats() 'webUrl' => 'getWebUrl' ]; + /** + * 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 TYPE_TRANSACTIONAL = 'transactional'; const TYPE_MARKETING = 'marketing'; @@ -148,6 +190,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getTypeAllowableValues() @@ -161,13 +204,16 @@ public function getTypeAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -180,44 +226,44 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['sender'] === null) { - $invalid_properties[] = "'sender' can't be null"; + $invalidProperties[] = "'sender' can't be null"; } if ((strlen($this->container['sender']) > 11)) { - $invalid_properties[] = "invalid value for 'sender', the character length must be smaller than or equal to 11."; + $invalidProperties[] = "invalid value for 'sender', the character length must be smaller than or equal to 11."; } if ($this->container['recipient'] === null) { - $invalid_properties[] = "'recipient' can't be null"; + $invalidProperties[] = "'recipient' can't be null"; } if ($this->container['content'] === null) { - $invalid_properties[] = "'content' can't be null"; + $invalidProperties[] = "'content' can't be null"; } if ((strlen($this->container['content']) > 160)) { - $invalid_properties[] = "invalid value for 'content', the character length must be smaller than or equal to 160."; + $invalidProperties[] = "invalid value for 'content', the character length must be smaller than or equal to 160."; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -240,8 +286,8 @@ public function valid() if (strlen($this->container['content']) > 160) { return false; } - $allowed_values = $this->getTypeAllowableValues(); - if (!in_array($this->container['type'], $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($this->container['type'], $allowedValues)) { return false; } return true; @@ -250,6 +296,7 @@ public function valid() /** * Gets sender + * * @return string */ public function getSender() @@ -259,7 +306,9 @@ public function getSender() /** * Sets sender + * * @param string $sender Name of the sender. Only alphanumeric characters. No more than 11 characters + * * @return $this */ public function setSender($sender) @@ -275,6 +324,7 @@ public function setSender($sender) /** * Gets recipient + * * @return string */ public function getRecipient() @@ -284,7 +334,9 @@ public function getRecipient() /** * Sets recipient + * * @param string $recipient Mobile number to send SMS with the country code + * * @return $this */ public function setRecipient($recipient) @@ -296,6 +348,7 @@ public function setRecipient($recipient) /** * Gets content + * * @return string */ public function getContent() @@ -305,7 +358,9 @@ public function getContent() /** * Sets content + * * @param string $content Content of the message. If more than 160 characters long, multiple text messages will be sent + * * @return $this */ public function setContent($content) @@ -321,6 +376,7 @@ public function setContent($content) /** * Gets type + * * @return string */ public function getType() @@ -330,17 +386,19 @@ public function getType() /** * Sets type + * * @param string $type Type of the SMS + * * @return $this */ public function setType($type) { - $allowed_values = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowed_values)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($type) && !in_array($type, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'type', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -351,6 +409,7 @@ public function setType($type) /** * Gets tag + * * @return string */ public function getTag() @@ -360,7 +419,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the message + * * @return $this */ public function setTag($tag) @@ -372,6 +433,7 @@ public function setTag($tag) /** * Gets webUrl + * * @return string */ public function getWebUrl() @@ -381,7 +443,9 @@ public function getWebUrl() /** * Sets webUrl + * * @param string $webUrl Webhook to call for each event triggered by the message (delivered etc.) + * * @return $this */ public function setWebUrl($webUrl) @@ -392,7 +456,9 @@ public function setWebUrl($webUrl) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -402,7 +468,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -412,8 +480,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -427,7 +497,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -437,15 +509,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateAttribute.php b/lib/Model/UpdateAttribute.php index e412fbe5..8fab6e04 100644 --- a/lib/Model/UpdateAttribute.php +++ b/lib/Model/UpdateAttribute.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateAttribute Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateAttribute implements ArrayAccess +class UpdateAttribute implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateAttribute'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class UpdateAttribute implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class UpdateAttribute implements ArrayAccess 'enumeration' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'enumeration' => 'enumeration' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'enumeration' => 'setEnumeration' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'enumeration' => 'getEnumeration' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets value + * * @return string */ public function getValue() @@ -177,7 +223,9 @@ public function getValue() /** * Sets value - * @param string $value Value of the attribute. Use only if the attribute's category is calculated or global + * + * @param string $value Value of the attribute to update. Use only if the attribute's category is 'calculated' or 'global' + * * @return $this */ public function setValue($value) @@ -189,6 +237,7 @@ public function setValue($value) /** * Gets enumeration + * * @return \SendinBlue\Client\Model\UpdateAttributeEnumeration[] */ public function getEnumeration() @@ -198,7 +247,9 @@ public function getEnumeration() /** * Sets enumeration - * @param \SendinBlue\Client\Model\UpdateAttributeEnumeration[] $enumeration Values that the attribute can take. Use only if the attribute's category is category + * + * @param \SendinBlue\Client\Model\UpdateAttributeEnumeration[] $enumeration List of the values and labels that the attribute can take. Use only if the attribute's category is \"category\". For example, [{'value':1, 'label':'male'}, {'value':2, 'label':'female'}] + * * @return $this */ public function setEnumeration($enumeration) @@ -209,7 +260,9 @@ public function setEnumeration($enumeration) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateAttributeEnumeration.php b/lib/Model/UpdateAttributeEnumeration.php index 43ba4cde..7c67fbc6 100644 --- a/lib/Model/UpdateAttributeEnumeration.php +++ b/lib/Model/UpdateAttributeEnumeration.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateAttributeEnumeration Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateAttributeEnumeration implements ArrayAccess +class UpdateAttributeEnumeration implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateAttribute_enumeration'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class UpdateAttributeEnumeration implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class UpdateAttributeEnumeration implements ArrayAccess 'label' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'label' => 'label' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'label' => 'setLabel' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'label' => 'getLabel' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,25 +187,25 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if ($this->container['value'] === null) { - $invalid_properties[] = "'value' can't be null"; + $invalidProperties[] = "'value' can't be null"; } if ($this->container['label'] === null) { - $invalid_properties[] = "'label' can't be null"; + $invalidProperties[] = "'label' can't be null"; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -180,6 +225,7 @@ public function valid() /** * Gets value + * * @return int */ public function getValue() @@ -189,7 +235,9 @@ public function getValue() /** * Sets value + * * @param int $value Id of the value + * * @return $this */ public function setValue($value) @@ -201,6 +249,7 @@ public function setValue($value) /** * Gets label + * * @return string */ public function getLabel() @@ -210,7 +259,9 @@ public function getLabel() /** * Sets label + * * @param string $label Label of the value + * * @return $this */ public function setLabel($label) @@ -221,7 +272,9 @@ public function setLabel($label) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -231,7 +284,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -241,8 +296,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -256,7 +313,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -266,15 +325,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateCampaignStatus.php b/lib/Model/UpdateCampaignStatus.php index 7f904379..00f96648 100644 --- a/lib/Model/UpdateCampaignStatus.php +++ b/lib/Model/UpdateCampaignStatus.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,28 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateCampaignStatus Class Doc Comment * - * @category Class + * @category Class * @description Status of the campaign - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateCampaignStatus implements ArrayAccess +class UpdateCampaignStatus implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateCampaignStatus'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,63 +63,102 @@ class UpdateCampaignStatus implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ 'status' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ 'status' => 'status' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ 'status' => 'setStatus' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ 'status' => 'getStatus' ]; + /** + * 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 STATUS_SUSPENDED = 'suspended'; const STATUS_ARCHIVE = 'archive'; const STATUS_DARCHIVE = 'darchive'; @@ -130,6 +172,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getStatusAllowableValues() @@ -149,13 +192,16 @@ public function getStatusAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -163,27 +209,27 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { - $invalid_properties[] = sprintf( + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { + $invalidProperties[] = sprintf( "invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ); } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -191,8 +237,8 @@ public function listInvalidProperties() public function valid() { - $allowed_values = $this->getStatusAllowableValues(); - if (!in_array($this->container['status'], $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($this->container['status'], $allowedValues)) { return false; } return true; @@ -201,6 +247,7 @@ public function valid() /** * Gets status + * * @return string */ public function getStatus() @@ -210,17 +257,19 @@ public function getStatus() /** * Sets status - * @param string $status + * + * @param string $status status + * * @return $this */ public function setStatus($status) { - $allowed_values = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowed_values)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'status', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -230,7 +279,9 @@ public function setStatus($status) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -240,7 +291,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -250,8 +303,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -265,7 +320,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -275,15 +332,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateChild.php b/lib/Model/UpdateChild.php index 5daa4c1a..2af84825 100644 --- a/lib/Model/UpdateChild.php +++ b/lib/Model/UpdateChild.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateChild Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateChild implements ArrayAccess +class UpdateChild implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateChild'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class UpdateChild implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class UpdateChild implements ArrayAccess 'password' => 'password' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'password' => 'password' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'password' => 'setPassword' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,34 +137,63 @@ public static function swaggerFormats() 'password' => 'getPassword' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -160,19 +205,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -186,6 +231,7 @@ public function valid() /** * Gets email + * * @return string */ public function getEmail() @@ -195,7 +241,9 @@ public function getEmail() /** * Sets email + * * @param string $email New Email address to update the child account + * * @return $this */ public function setEmail($email) @@ -207,6 +255,7 @@ public function setEmail($email) /** * Gets firstName + * * @return string */ public function getFirstName() @@ -216,7 +265,9 @@ public function getFirstName() /** * Sets firstName + * * @param string $firstName New First name to use to update the child account + * * @return $this */ public function setFirstName($firstName) @@ -228,6 +279,7 @@ public function setFirstName($firstName) /** * Gets lastName + * * @return string */ public function getLastName() @@ -237,7 +289,9 @@ public function getLastName() /** * Sets lastName + * * @param string $lastName New Last name to use to update the child account + * * @return $this */ public function setLastName($lastName) @@ -249,6 +303,7 @@ public function setLastName($lastName) /** * Gets companyName + * * @return string */ public function getCompanyName() @@ -258,7 +313,9 @@ public function getCompanyName() /** * Sets companyName + * * @param string $companyName New Company name to use to update the child account + * * @return $this */ public function setCompanyName($companyName) @@ -270,6 +327,7 @@ public function setCompanyName($companyName) /** * Gets password + * * @return string */ public function getPassword() @@ -279,7 +337,9 @@ public function getPassword() /** * Sets password + * * @param string $password New password for the child account to login + * * @return $this */ public function setPassword($password) @@ -290,7 +350,9 @@ public function setPassword($password) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -300,7 +362,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -310,8 +374,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -325,7 +391,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -335,15 +403,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateContact.php b/lib/Model/UpdateContact.php index 92fbbf9d..1213a2e1 100644 --- a/lib/Model/UpdateContact.php +++ b/lib/Model/UpdateContact.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,31 +30,34 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateContact Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateContact implements ArrayAccess +class UpdateContact implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateContact'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ - 'attributes' => 'map[string,string]', + 'attributes' => 'object', 'emailBlacklisted' => 'bool', 'smsBlacklisted' => 'bool', 'listIds' => 'int[]', @@ -64,6 +67,7 @@ class UpdateContact implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -75,18 +79,30 @@ class UpdateContact implements ArrayAccess 'smtpBlacklistSender' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -98,9 +114,9 @@ public static function swaggerFormats() 'smtpBlacklistSender' => 'smtpBlacklistSender' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -112,9 +128,9 @@ public static function swaggerFormats() 'smtpBlacklistSender' => 'setSmtpBlacklistSender' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -126,34 +142,63 @@ public static function swaggerFormats() 'smtpBlacklistSender' => 'getSmtpBlacklistSender' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -166,19 +211,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -192,7 +237,8 @@ public function valid() /** * Gets attributes - * @return map[string,string] + * + * @return object */ public function getAttributes() { @@ -201,7 +247,9 @@ public function getAttributes() /** * Sets attributes - * @param map[string,string] $attributes + * + * @param object $attributes Pass the set of attributes to be updated. These attributes must be present in your account. For eg. {'FNAME':'Ellie', 'LNAME':'Roger'} + * * @return $this */ public function setAttributes($attributes) @@ -213,6 +261,7 @@ public function setAttributes($attributes) /** * Gets emailBlacklisted + * * @return bool */ public function getEmailBlacklisted() @@ -222,7 +271,9 @@ public function getEmailBlacklisted() /** * Sets emailBlacklisted - * @param bool $emailBlacklisted Blacklist the contact for emails (emailBlacklisted = true) + * + * @param bool $emailBlacklisted Set/unset this field to blacklist/allow the contact for emails (emailBlacklisted = true) + * * @return $this */ public function setEmailBlacklisted($emailBlacklisted) @@ -234,6 +285,7 @@ public function setEmailBlacklisted($emailBlacklisted) /** * Gets smsBlacklisted + * * @return bool */ public function getSmsBlacklisted() @@ -243,7 +295,9 @@ public function getSmsBlacklisted() /** * Sets smsBlacklisted - * @param bool $smsBlacklisted Blacklist the contact for SMS (smsBlacklisted = true) + * + * @param bool $smsBlacklisted Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true) + * * @return $this */ public function setSmsBlacklisted($smsBlacklisted) @@ -255,6 +309,7 @@ public function setSmsBlacklisted($smsBlacklisted) /** * Gets listIds + * * @return int[] */ public function getListIds() @@ -264,7 +319,9 @@ public function getListIds() /** * Sets listIds + * * @param int[] $listIds Ids of the lists to add the contact to + * * @return $this */ public function setListIds($listIds) @@ -276,6 +333,7 @@ public function setListIds($listIds) /** * Gets unlinkListIds + * * @return int[] */ public function getUnlinkListIds() @@ -285,7 +343,9 @@ public function getUnlinkListIds() /** * Sets unlinkListIds + * * @param int[] $unlinkListIds Ids of the lists to remove the contact from + * * @return $this */ public function setUnlinkListIds($unlinkListIds) @@ -297,6 +357,7 @@ public function setUnlinkListIds($unlinkListIds) /** * Gets smtpBlacklistSender + * * @return string[] */ public function getSmtpBlacklistSender() @@ -306,7 +367,9 @@ public function getSmtpBlacklistSender() /** * Sets smtpBlacklistSender + * * @param string[] $smtpBlacklistSender SMTP forbidden sender for contact. Use only for email Contact + * * @return $this */ public function setSmtpBlacklistSender($smtpBlacklistSender) @@ -317,7 +380,9 @@ public function setSmtpBlacklistSender($smtpBlacklistSender) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -327,7 +392,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -337,8 +404,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -352,7 +421,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -362,15 +433,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateEmailCampaign.php b/lib/Model/UpdateEmailCampaign.php index ff8eeff5..84b0b235 100644 --- a/lib/Model/UpdateEmailCampaign.php +++ b/lib/Model/UpdateEmailCampaign.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateEmailCampaign Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateEmailCampaign implements ArrayAccess +class UpdateEmailCampaign implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateEmailCampaign'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -75,6 +78,7 @@ class UpdateEmailCampaign implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -97,18 +101,30 @@ class UpdateEmailCampaign implements ArrayAccess 'utmCampaign' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -131,9 +147,9 @@ public static function swaggerFormats() 'utmCampaign' => 'utmCampaign' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -156,9 +172,9 @@ public static function swaggerFormats() 'utmCampaign' => 'setUtmCampaign' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -181,34 +197,63 @@ public static function swaggerFormats() 'utmCampaign' => 'getUtmCampaign' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -232,19 +277,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -258,6 +303,7 @@ public function valid() /** * Gets tag + * * @return string */ public function getTag() @@ -267,7 +313,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the campaign + * * @return $this */ public function setTag($tag) @@ -279,6 +327,7 @@ public function setTag($tag) /** * Gets sender + * * @return \SendinBlue\Client\Model\UpdateEmailCampaignSender */ public function getSender() @@ -288,7 +337,9 @@ public function getSender() /** * Sets sender - * @param \SendinBlue\Client\Model\UpdateEmailCampaignSender $sender + * + * @param \SendinBlue\Client\Model\UpdateEmailCampaignSender $sender sender + * * @return $this */ public function setSender($sender) @@ -300,6 +351,7 @@ public function setSender($sender) /** * Gets name + * * @return string */ public function getName() @@ -309,7 +361,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the campaign + * * @return $this */ public function setName($name) @@ -321,6 +375,7 @@ public function setName($name) /** * Gets htmlContent + * * @return string */ public function getHtmlContent() @@ -330,7 +385,9 @@ public function getHtmlContent() /** * Sets htmlContent + * * @param string $htmlContent Body of the message (HTML version). REQUIRED if htmlUrl is empty + * * @return $this */ public function setHtmlContent($htmlContent) @@ -342,6 +399,7 @@ public function setHtmlContent($htmlContent) /** * Gets htmlUrl + * * @return string */ public function getHtmlUrl() @@ -351,7 +409,9 @@ public function getHtmlUrl() /** * Sets htmlUrl + * * @param string $htmlUrl Url which contents the body of the email message. REQUIRED if htmlContent is empty + * * @return $this */ public function setHtmlUrl($htmlUrl) @@ -363,6 +423,7 @@ public function setHtmlUrl($htmlUrl) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -372,7 +433,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -384,6 +447,7 @@ public function setScheduledAt($scheduledAt) /** * Gets subject + * * @return string */ public function getSubject() @@ -393,7 +457,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the campaign + * * @return $this */ public function setSubject($subject) @@ -405,6 +471,7 @@ public function setSubject($subject) /** * Gets replyTo + * * @return string */ public function getReplyTo() @@ -414,7 +481,9 @@ public function getReplyTo() /** * Sets replyTo + * * @param string $replyTo Email on which campaign recipients will be able to reply to + * * @return $this */ public function setReplyTo($replyTo) @@ -426,6 +495,7 @@ public function setReplyTo($replyTo) /** * Gets toField + * * @return string */ public function getToField() @@ -435,7 +505,9 @@ public function getToField() /** * Sets toField + * * @param string $toField This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. To use the contact attributes here, these must already exist in SendinBlue account + * * @return $this */ public function setToField($toField) @@ -447,6 +519,7 @@ public function setToField($toField) /** * Gets recipients + * * @return \SendinBlue\Client\Model\UpdateEmailCampaignRecipients */ public function getRecipients() @@ -456,7 +529,9 @@ public function getRecipients() /** * Sets recipients - * @param \SendinBlue\Client\Model\UpdateEmailCampaignRecipients $recipients + * + * @param \SendinBlue\Client\Model\UpdateEmailCampaignRecipients $recipients recipients + * * @return $this */ public function setRecipients($recipients) @@ -468,6 +543,7 @@ public function setRecipients($recipients) /** * Gets attachmentUrl + * * @return string */ public function getAttachmentUrl() @@ -477,7 +553,9 @@ public function getAttachmentUrl() /** * Sets attachmentUrl + * * @param string $attachmentUrl Absolute url of the attachment (no local file). Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps + * * @return $this */ public function setAttachmentUrl($attachmentUrl) @@ -489,6 +567,7 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets inlineImageActivation + * * @return bool */ public function getInlineImageActivation() @@ -498,7 +577,9 @@ public function getInlineImageActivation() /** * Sets inlineImageActivation + * * @param bool $inlineImageActivation Status of inline image. inlineImageActivation = false means image can’t be embedded, & inlineImageActivation = true means image can be embedded, in the email. You cannot send a campaign of more than 4MB with images embedded in the email. Campaigns with the images embedded in the email must be sent to less than 5000 contacts. + * * @return $this */ public function setInlineImageActivation($inlineImageActivation) @@ -510,6 +591,7 @@ public function setInlineImageActivation($inlineImageActivation) /** * Gets mirrorActive + * * @return bool */ public function getMirrorActive() @@ -519,7 +601,9 @@ public function getMirrorActive() /** * Sets mirrorActive + * * @param bool $mirrorActive Status of mirror links in campaign. mirrorActive = false means mirror links are deactivated, & mirrorActive = true means mirror links are activated, in the campaign + * * @return $this */ public function setMirrorActive($mirrorActive) @@ -531,6 +615,7 @@ public function setMirrorActive($mirrorActive) /** * Gets recurring + * * @return bool */ public function getRecurring() @@ -540,7 +625,9 @@ public function getRecurring() /** * Sets recurring + * * @param bool $recurring FOR TRIGGER ONLY ! Type of trigger campaign.recurring = false means contact can receive the same Trigger campaign only once, & recurring = true means contact can receive the same Trigger campaign several times + * * @return $this */ public function setRecurring($recurring) @@ -552,6 +639,7 @@ public function setRecurring($recurring) /** * Gets footer + * * @return string */ public function getFooter() @@ -561,7 +649,9 @@ public function getFooter() /** * Sets footer + * * @param string $footer Footer of the email campaign + * * @return $this */ public function setFooter($footer) @@ -573,6 +663,7 @@ public function setFooter($footer) /** * Gets header + * * @return string */ public function getHeader() @@ -582,7 +673,9 @@ public function getHeader() /** * Sets header + * * @param string $header Header of the email campaign + * * @return $this */ public function setHeader($header) @@ -594,6 +687,7 @@ public function setHeader($header) /** * Gets utmCampaign + * * @return string */ public function getUtmCampaign() @@ -603,7 +697,9 @@ public function getUtmCampaign() /** * Sets utmCampaign + * * @param string $utmCampaign Customize the utm_campaign value. If this field is empty, the campaign name will be used. Only alphanumeric characters and spaces are allowed + * * @return $this */ public function setUtmCampaign($utmCampaign) @@ -614,7 +710,9 @@ public function setUtmCampaign($utmCampaign) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -624,7 +722,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -634,8 +734,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -649,7 +751,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -659,15 +763,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateEmailCampaignRecipients.php b/lib/Model/UpdateEmailCampaignRecipients.php index e29272d2..d9333399 100644 --- a/lib/Model/UpdateEmailCampaignRecipients.php +++ b/lib/Model/UpdateEmailCampaignRecipients.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateEmailCampaignRecipients Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description List ids to include/exclude from campaign + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateEmailCampaignRecipients implements ArrayAccess +class UpdateEmailCampaignRecipients implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateEmailCampaign_recipients'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +64,7 @@ class UpdateEmailCampaignRecipients implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +72,30 @@ class UpdateEmailCampaignRecipients implements ArrayAccess 'listIds' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +103,9 @@ public static function swaggerFormats() 'listIds' => 'listIds' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +113,9 @@ public static function swaggerFormats() 'listIds' => 'setListIds' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +123,63 @@ public static function swaggerFormats() 'listIds' => 'getListIds' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +188,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +214,7 @@ public function valid() /** * Gets exclusionListIds + * * @return int[] */ public function getExclusionListIds() @@ -177,7 +224,9 @@ public function getExclusionListIds() /** * Sets exclusionListIds + * * @param int[] $exclusionListIds List ids which have to be excluded from a campaign + * * @return $this */ public function setExclusionListIds($exclusionListIds) @@ -189,6 +238,7 @@ public function setExclusionListIds($exclusionListIds) /** * Gets listIds + * * @return int[] */ public function getListIds() @@ -198,7 +248,9 @@ public function getListIds() /** * Sets listIds + * * @param int[] $listIds Lists Ids to send the campaign to. REQUIRED if already not present in campaign and scheduledAt is not empty + * * @return $this */ public function setListIds($listIds) @@ -209,7 +261,9 @@ public function setListIds($listIds) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +273,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +285,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +302,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +314,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateEmailCampaignSender.php b/lib/Model/UpdateEmailCampaignSender.php index e434b940..71fc4758 100644 --- a/lib/Model/UpdateEmailCampaignSender.php +++ b/lib/Model/UpdateEmailCampaignSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateEmailCampaignSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description Sender details including email and/or name. For example {'name':'xyz' , 'email':'example@abc.com'} + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateEmailCampaignSender implements ArrayAccess +class UpdateEmailCampaignSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateEmailCampaign_sender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +64,7 @@ class UpdateEmailCampaignSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +72,30 @@ class UpdateEmailCampaignSender implements ArrayAccess 'email' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +103,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +113,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +123,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +188,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +214,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -177,7 +224,9 @@ public function getName() /** * Sets name + * * @param string $name Sender Name from which the campaign emails are sent + * * @return $this */ public function setName($name) @@ -189,6 +238,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -198,7 +248,9 @@ public function getEmail() /** * Sets email + * * @param string $email Sender email from which the campaign emails are sent + * * @return $this */ public function setEmail($email) @@ -209,7 +261,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +273,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +285,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +302,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +314,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateList.php b/lib/Model/UpdateList.php index 77e874c3..1055fa9e 100644 --- a/lib/Model/UpdateList.php +++ b/lib/Model/UpdateList.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateList Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateList implements ArrayAccess +class UpdateList implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateList'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +63,7 @@ class UpdateList implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +71,30 @@ class UpdateList implements ArrayAccess 'folderId' => 'int64' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +102,9 @@ public static function swaggerFormats() 'folderId' => 'folderId' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +112,9 @@ public static function swaggerFormats() 'folderId' => 'setFolderId' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +122,63 @@ public static function swaggerFormats() 'folderId' => 'getFolderId' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +187,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +213,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -177,7 +223,9 @@ public function getName() /** * Sets name - * @param string $name Name of the list. Only one parameter can be update at once + * + * @param string $name Name of the list. Either of the two parameters (name, folderId) can be updated at a time. + * * @return $this */ public function setName($name) @@ -189,6 +237,7 @@ public function setName($name) /** * Gets folderId + * * @return int */ public function getFolderId() @@ -198,7 +247,9 @@ public function getFolderId() /** * Sets folderId - * @param int $folderId Id of the folder in which to move the list. Only one parameter can updated at once + * + * @param int $folderId Id of the folder in which the list is to be moved. Either of the two parameters (name, folderId) can be updated at a time. + * * @return $this */ public function setFolderId($folderId) @@ -209,7 +260,9 @@ public function setFolderId($folderId) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +272,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +284,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +301,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +313,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateSender.php b/lib/Model/UpdateSender.php index 80b0db9f..0a3b8550 100644 --- a/lib/Model/UpdateSender.php +++ b/lib/Model/UpdateSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateSender implements ArrayAccess +class UpdateSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateSender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class UpdateSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class UpdateSender implements ArrayAccess 'ips' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'ips' => 'ips' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'ips' => 'setIps' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,34 +127,63 @@ public static function swaggerFormats() 'ips' => 'getIps' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -148,19 +193,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -174,6 +219,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -183,7 +229,9 @@ public function getName() /** * Sets name + * * @param string $name From Name to update the sender + * * @return $this */ public function setName($name) @@ -195,6 +243,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -204,7 +253,9 @@ public function getEmail() /** * Sets email + * * @param string $email From Email to update the sender + * * @return $this */ public function setEmail($email) @@ -216,6 +267,7 @@ public function setEmail($email) /** * Gets ips + * * @return \SendinBlue\Client\Model\CreateSenderIps[] */ public function getIps() @@ -225,7 +277,9 @@ public function getIps() /** * Sets ips + * * @param \SendinBlue\Client\Model\CreateSenderIps[] $ips Only in case of dedicated IP, IPs to associate to the sender. If passed, will replace all the existing IPs. + * * @return $this */ public function setIps($ips) @@ -236,7 +290,9 @@ public function setIps($ips) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -246,7 +302,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -256,8 +314,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -271,7 +331,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -281,15 +343,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateSmsCampaign.php b/lib/Model/UpdateSmsCampaign.php index dc479fdc..4a8322ff 100644 --- a/lib/Model/UpdateSmsCampaign.php +++ b/lib/Model/UpdateSmsCampaign.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateSmsCampaign Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateSmsCampaign implements ArrayAccess +class UpdateSmsCampaign implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateSmsCampaign'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -63,6 +66,7 @@ class UpdateSmsCampaign implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -73,18 +77,30 @@ class UpdateSmsCampaign implements ArrayAccess 'scheduledAt' => 'date-time' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -95,9 +111,9 @@ public static function swaggerFormats() 'scheduledAt' => 'scheduledAt' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -108,9 +124,9 @@ public static function swaggerFormats() 'scheduledAt' => 'setScheduledAt' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -121,34 +137,63 @@ public static function swaggerFormats() 'scheduledAt' => 'getScheduledAt' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -160,23 +205,23 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; if (!is_null($this->container['sender']) && (strlen($this->container['sender']) > 11)) { - $invalid_properties[] = "invalid value for 'sender', the character length must be smaller than or equal to 11."; + $invalidProperties[] = "invalid value for 'sender', the character length must be smaller than or equal to 11."; } - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -193,6 +238,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -202,7 +248,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the campaign + * * @return $this */ public function setName($name) @@ -214,6 +262,7 @@ public function setName($name) /** * Gets sender + * * @return string */ public function getSender() @@ -223,7 +272,9 @@ public function getSender() /** * Sets sender + * * @param string $sender Name of the sender. The number of characters is limited to 11 + * * @return $this */ public function setSender($sender) @@ -239,6 +290,7 @@ public function setSender($sender) /** * Gets content + * * @return string */ public function getContent() @@ -248,7 +300,9 @@ public function getContent() /** * Sets content + * * @param string $content Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS + * * @return $this */ public function setContent($content) @@ -260,6 +314,7 @@ public function setContent($content) /** * Gets recipients + * * @return \SendinBlue\Client\Model\CreateSmsCampaignRecipients */ public function getRecipients() @@ -269,7 +324,9 @@ public function getRecipients() /** * Sets recipients - * @param \SendinBlue\Client\Model\CreateSmsCampaignRecipients $recipients + * + * @param \SendinBlue\Client\Model\CreateSmsCampaignRecipients $recipients recipients + * * @return $this */ public function setRecipients($recipients) @@ -281,6 +338,7 @@ public function setRecipients($recipients) /** * Gets scheduledAt + * * @return \DateTime */ public function getScheduledAt() @@ -290,7 +348,9 @@ public function getScheduledAt() /** * Sets scheduledAt + * * @param \DateTime $scheduledAt UTC date-time on which the campaign has to run (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. + * * @return $this */ public function setScheduledAt($scheduledAt) @@ -301,7 +361,9 @@ public function setScheduledAt($scheduledAt) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -311,7 +373,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -321,8 +385,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -336,7 +402,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -346,15 +414,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateSmtpTemplate.php b/lib/Model/UpdateSmtpTemplate.php index 8083b242..d39cde75 100644 --- a/lib/Model/UpdateSmtpTemplate.php +++ b/lib/Model/UpdateSmtpTemplate.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateSmtpTemplate Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateSmtpTemplate implements ArrayAccess +class UpdateSmtpTemplate implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateSmtpTemplate'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -68,6 +71,7 @@ class UpdateSmtpTemplate implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -83,18 +87,30 @@ class UpdateSmtpTemplate implements ArrayAccess 'isActive' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -110,9 +126,9 @@ public static function swaggerFormats() 'isActive' => 'isActive' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -128,9 +144,9 @@ public static function swaggerFormats() 'isActive' => 'setIsActive' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -146,34 +162,63 @@ public static function swaggerFormats() 'isActive' => 'getIsActive' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -190,19 +235,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -216,6 +261,7 @@ public function valid() /** * Gets tag + * * @return string */ public function getTag() @@ -225,7 +271,9 @@ public function getTag() /** * Sets tag + * * @param string $tag Tag of the template + * * @return $this */ public function setTag($tag) @@ -237,6 +285,7 @@ public function setTag($tag) /** * Gets sender + * * @return \SendinBlue\Client\Model\UpdateSmtpTemplateSender */ public function getSender() @@ -246,7 +295,9 @@ public function getSender() /** * Sets sender - * @param \SendinBlue\Client\Model\UpdateSmtpTemplateSender $sender + * + * @param \SendinBlue\Client\Model\UpdateSmtpTemplateSender $sender sender + * * @return $this */ public function setSender($sender) @@ -258,6 +309,7 @@ public function setSender($sender) /** * Gets templateName + * * @return string */ public function getTemplateName() @@ -267,7 +319,9 @@ public function getTemplateName() /** * Sets templateName + * * @param string $templateName Name of the template + * * @return $this */ public function setTemplateName($templateName) @@ -279,6 +333,7 @@ public function setTemplateName($templateName) /** * Gets htmlContent + * * @return string */ public function getHtmlContent() @@ -288,7 +343,9 @@ public function getHtmlContent() /** * Sets htmlContent + * * @param string $htmlContent Required if htmlUrl is empty. Body of the message (HTML must have more than 10 characters) + * * @return $this */ public function setHtmlContent($htmlContent) @@ -300,6 +357,7 @@ public function setHtmlContent($htmlContent) /** * Gets htmlUrl + * * @return string */ public function getHtmlUrl() @@ -309,7 +367,9 @@ public function getHtmlUrl() /** * Sets htmlUrl + * * @param string $htmlUrl Required if htmlContent is empty. URL to the body of the email (HTML) + * * @return $this */ public function setHtmlUrl($htmlUrl) @@ -321,6 +381,7 @@ public function setHtmlUrl($htmlUrl) /** * Gets subject + * * @return string */ public function getSubject() @@ -330,7 +391,9 @@ public function getSubject() /** * Sets subject + * * @param string $subject Subject of the email + * * @return $this */ public function setSubject($subject) @@ -342,6 +405,7 @@ public function setSubject($subject) /** * Gets replyTo + * * @return string */ public function getReplyTo() @@ -351,7 +415,9 @@ public function getReplyTo() /** * Sets replyTo + * * @param string $replyTo Email on which campaign recipients will be able to reply to + * * @return $this */ public function setReplyTo($replyTo) @@ -363,6 +429,7 @@ public function setReplyTo($replyTo) /** * Gets toField + * * @return string */ public function getToField() @@ -372,7 +439,9 @@ public function getToField() /** * Sets toField + * * @param string $toField To personalize the «To» Field, e.g. if you want to include the first name and last name of your recipient, add {FNAME} {LNAME}. These attributes must already exist in contacts database + * * @return $this */ public function setToField($toField) @@ -384,6 +453,7 @@ public function setToField($toField) /** * Gets attachmentUrl + * * @return string */ public function getAttachmentUrl() @@ -393,7 +463,9 @@ public function getAttachmentUrl() /** * Sets attachmentUrl + * * @param string $attachmentUrl Absolute url of the attachment (no local file). Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps + * * @return $this */ public function setAttachmentUrl($attachmentUrl) @@ -405,6 +477,7 @@ public function setAttachmentUrl($attachmentUrl) /** * Gets isActive + * * @return bool */ public function getIsActive() @@ -414,7 +487,9 @@ public function getIsActive() /** * Sets isActive + * * @param bool $isActive Status of the template. isActive = false means template is inactive, isActive = true means template is active + * * @return $this */ public function setIsActive($isActive) @@ -425,7 +500,9 @@ public function setIsActive($isActive) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -435,7 +512,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -445,8 +524,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -460,7 +541,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -470,15 +553,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateSmtpTemplateSender.php b/lib/Model/UpdateSmtpTemplateSender.php index 857d909f..cf554de5 100644 --- a/lib/Model/UpdateSmtpTemplateSender.php +++ b/lib/Model/UpdateSmtpTemplateSender.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,31 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateSmtpTemplateSender Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @description Sender details including email and/or name. For example {'name':'xyz' , 'email':'example@abc.com'} + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateSmtpTemplateSender implements ArrayAccess +class UpdateSmtpTemplateSender implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateSmtpTemplate_sender'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -60,6 +64,7 @@ class UpdateSmtpTemplateSender implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -67,18 +72,30 @@ class UpdateSmtpTemplateSender implements ArrayAccess 'email' => 'email' ]; + /** + * 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -86,9 +103,9 @@ public static function swaggerFormats() 'email' => 'email' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -96,9 +113,9 @@ public static function swaggerFormats() 'email' => 'setEmail' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -106,34 +123,63 @@ public static function swaggerFormats() 'email' => 'getEmail' ]; + /** + * 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; + } + /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -142,19 +188,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -168,6 +214,7 @@ public function valid() /** * Gets name + * * @return string */ public function getName() @@ -177,7 +224,9 @@ public function getName() /** * Sets name + * * @param string $name Name of the sender + * * @return $this */ public function setName($name) @@ -189,6 +238,7 @@ public function setName($name) /** * Gets email + * * @return string */ public function getEmail() @@ -198,7 +248,9 @@ public function getEmail() /** * Sets email + * * @param string $email Email of the sender + * * @return $this */ public function setEmail($email) @@ -209,7 +261,9 @@ public function setEmail($email) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -219,7 +273,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -229,8 +285,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -244,7 +302,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -254,15 +314,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/Model/UpdateWebhook.php b/lib/Model/UpdateWebhook.php index c532aeea..9e2012ea 100644 --- a/lib/Model/UpdateWebhook.php +++ b/lib/Model/UpdateWebhook.php @@ -6,7 +6,7 @@ * * @category Class * @package SendinBlue\Client - * @author Swaagger Codegen team + * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ @@ -18,7 +18,7 @@ * 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 */ /** @@ -30,27 +30,30 @@ namespace SendinBlue\Client\Model; use \ArrayAccess; +use \SendinBlue\Client\ObjectSerializer; /** * UpdateWebhook Class Doc Comment * - * @category Class - * @package SendinBlue\Client - * @author Swagger Codegen team - * @link https://github.com/swagger-api/swagger-codegen + * @category Class + * @package SendinBlue\Client + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen */ -class UpdateWebhook implements ArrayAccess +class UpdateWebhook implements ModelInterface, ArrayAccess { const DISCRIMINATOR = null; /** * The original name of the model. + * * @var string */ protected static $swaggerModelName = 'updateWebhook'; /** * Array of property to type mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerTypes = [ @@ -61,6 +64,7 @@ class UpdateWebhook implements ArrayAccess /** * Array of property to format mappings. Used for (de)serialization + * * @var string[] */ protected static $swaggerFormats = [ @@ -69,18 +73,30 @@ class UpdateWebhook implements ArrayAccess 'events' => 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 + * Array of attributes where the key is the local name, + * and the value is the original name + * * @var string[] */ protected static $attributeMap = [ @@ -89,9 +105,9 @@ public static function swaggerFormats() 'events' => 'events' ]; - /** * Array of attributes to setter functions (for deserialization of responses) + * * @var string[] */ protected static $setters = [ @@ -100,9 +116,9 @@ public static function swaggerFormats() 'events' => 'setEvents' ]; - /** * Array of attributes to getter functions (for serialization of requests) + * * @var string[] */ protected static $getters = [ @@ -111,21 +127,47 @@ public static function swaggerFormats() 'events' => 'getEvents' ]; + /** + * 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 EVENTS_HARD_BOUNCE = 'hardBounce'; const EVENTS_SOFT_BOUNCE = 'softBounce'; const EVENTS_BLOCKED = 'blocked'; @@ -144,6 +186,7 @@ public static function getters() /** * Gets allowable values of the enum + * * @return string[] */ public function getEventsAllowableValues() @@ -168,13 +211,16 @@ public function getEventsAllowableValues() /** * Associative array for storing property values + * * @var mixed[] */ protected $container = []; /** * Constructor - * @param mixed[] $data Associated array of property values initializing the model + * + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { @@ -184,19 +230,19 @@ public function __construct(array $data = null) } /** - * show all the invalid properties with reasons. + * Show all the invalid properties with reasons. * * @return array invalid properties with reasons */ public function listInvalidProperties() { - $invalid_properties = []; + $invalidProperties = []; - return $invalid_properties; + return $invalidProperties; } /** - * validate all the properties in the model + * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid @@ -210,6 +256,7 @@ public function valid() /** * Gets url + * * @return string */ public function getUrl() @@ -219,7 +266,9 @@ public function getUrl() /** * Sets url + * * @param string $url URL of the webhook + * * @return $this */ public function setUrl($url) @@ -231,6 +280,7 @@ public function setUrl($url) /** * Gets description + * * @return string */ public function getDescription() @@ -240,7 +290,9 @@ public function getDescription() /** * Sets description + * * @param string $description Description of the webhook + * * @return $this */ public function setDescription($description) @@ -252,6 +304,7 @@ public function setDescription($description) /** * Gets events + * * @return string[] */ public function getEvents() @@ -261,17 +314,19 @@ public function getEvents() /** * Sets events + * * @param string[] $events Events triggering the webhook. Possible values for Transactional type webhook – request, delivered, hardBounce, softBounce, blocked, spam, invalid, deferred, click, opened, uniqueOpened and unsubscribed and possible values for Marketing type webhook – spam, opened, click, hardBounce, softBounce, unsubscribed, listAddition and delivered + * * @return $this */ public function setEvents($events) { - $allowed_values = $this->getEventsAllowableValues(); - if (!is_null($events) && array_diff($events, $allowed_values)) { + $allowedValues = $this->getEventsAllowableValues(); + if (!is_null($events) && array_diff($events, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'events', must be one of '%s'", - implode("', '", $allowed_values) + implode("', '", $allowedValues) ) ); } @@ -281,7 +336,9 @@ public function setEvents($events) } /** * Returns true if offset exists. False otherwise. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return boolean */ public function offsetExists($offset) @@ -291,7 +348,9 @@ public function offsetExists($offset) /** * Gets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return mixed */ public function offsetGet($offset) @@ -301,8 +360,10 @@ public function offsetGet($offset) /** * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * * @return void */ public function offsetSet($offset, $value) @@ -316,7 +377,9 @@ public function offsetSet($offset, $value) /** * Unsets offset. - * @param integer $offset Offset + * + * @param integer $offset Offset + * * @return void */ public function offsetUnset($offset) @@ -326,15 +389,19 @@ public function offsetUnset($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(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); } - return json_encode(\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this)); + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } } diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php index df1f8719..3068625b 100644 --- a/lib/ObjectSerializer.php +++ b/lib/ObjectSerializer.php @@ -18,7 +18,7 @@ * 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 */ /** @@ -65,7 +65,9 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::swaggerTypes() as $property => $swaggerType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && method_exists($swaggerType, 'getAllowableEnumValues') + if ($value !== null + && !in_array($swaggerType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) + && method_exists($swaggerType, 'getAllowableEnumValues') && !in_array($value, $swaggerType::getAllowableEnumValues())) { $imploded = implode("', '", $swaggerType::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'"); @@ -105,9 +107,9 @@ public static function sanitizeFilename($filename) * * @return string the serialized object */ - public function toPathValue($value) + public static function toPathValue($value) { - return rawurlencode($this->toString($value)); + return rawurlencode(self::toString($value)); } /** @@ -120,12 +122,12 @@ public function toPathValue($value) * * @return string the serialized object */ - public function toQueryValue($object) + public static function toQueryValue($object) { if (is_array($object)) { return implode(',', $object); } else { - return $this->toString($object); + return self::toString($object); } } @@ -138,9 +140,9 @@ public function toQueryValue($object) * * @return string the header string */ - public function toHeaderValue($value) + public static function toHeaderValue($value) { - return $this->toString($value); + return self::toString($value); } /** @@ -152,12 +154,12 @@ public function toHeaderValue($value) * * @return string the form string */ - public function toFormValue($value) + public static function toFormValue($value) { if ($value instanceof \SplFileObject) { return $value->getRealPath(); } else { - return $this->toString($value); + return self::toString($value); } } @@ -170,7 +172,7 @@ public function toFormValue($value) * * @return string the header string */ - public function toString($value) + public static function toString($value) { if ($value instanceof \DateTime) { // datetime in ISO8601 format return $value->format(\DateTime::ATOM); @@ -189,7 +191,7 @@ public function toString($value) * * @return string */ - public function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) + public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) { if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { // http_build_query() almost does the job for us. We just @@ -264,6 +266,8 @@ public static function deserialize($data, $class, $httpHeaders = null) settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { + /** @var \Psr\Http\Message\StreamInterface $data */ + // determine file name if (array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { @@ -271,13 +275,14 @@ public static function deserialize($data, $class, $httpHeaders = null) } else { $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); } - $deserialized = new \SplFileObject($filename, "w"); - $byte_written = $deserialized->fwrite($data); - if (Configuration::getDefaultConfiguration()->getDebug()) { - error_log("[DEBUG] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.".PHP_EOL, 3, Configuration::getDefaultConfiguration()->getDebugFile()); + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); } + fclose($file); - return $deserialized; + return new \SplFileObject($filename, 'r'); } elseif (method_exists($class, 'getAllowableEnumValues')) { if (!in_array($data, $class::getAllowableEnumValues())) { $imploded = implode("', '", $class::getAllowableEnumValues()); diff --git a/test/Api/AccountApiTest.php b/test/Api/AccountApiTest.php index feaab774..bb4b3902 100644 --- a/test/Api/AccountApiTest.php +++ b/test/Api/AccountApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/AttributesApiTest.php b/test/Api/AttributesApiTest.php index c14520bd..3a825592 100644 --- a/test/Api/AttributesApiTest.php +++ b/test/Api/AttributesApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/ContactsApiTest.php b/test/Api/ContactsApiTest.php index 148c0d1c..e8fdd23b 100644 --- a/test/Api/ContactsApiTest.php +++ b/test/Api/ContactsApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/EmailCampaignsApiTest.php b/test/Api/EmailCampaignsApiTest.php index d742a6ab..93ff3f3c 100644 --- a/test/Api/EmailCampaignsApiTest.php +++ b/test/Api/EmailCampaignsApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/FoldersApiTest.php b/test/Api/FoldersApiTest.php index a595e29c..2bd58e7f 100644 --- a/test/Api/FoldersApiTest.php +++ b/test/Api/FoldersApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/ListsApiTest.php b/test/Api/ListsApiTest.php index bc8059c0..b2c67082 100644 --- a/test/Api/ListsApiTest.php +++ b/test/Api/ListsApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/ProcessApiTest.php b/test/Api/ProcessApiTest.php index a8f9e2bd..6cf4d73b 100644 --- a/test/Api/ProcessApiTest.php +++ b/test/Api/ProcessApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/ResellerApiTest.php b/test/Api/ResellerApiTest.php index 1a4a5640..29428996 100644 --- a/test/Api/ResellerApiTest.php +++ b/test/Api/ResellerApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/SMSCampaignsApiTest.php b/test/Api/SMSCampaignsApiTest.php index e473a685..3301b72c 100644 --- a/test/Api/SMSCampaignsApiTest.php +++ b/test/Api/SMSCampaignsApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/SMTPApiTest.php b/test/Api/SMTPApiTest.php index 1b90bcdc..6d4d35c7 100644 --- a/test/Api/SMTPApiTest.php +++ b/test/Api/SMTPApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/SendersApiTest.php b/test/Api/SendersApiTest.php index e49ee30e..a8ce6b33 100644 --- a/test/Api/SendersApiTest.php +++ b/test/Api/SendersApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/TransactionalSMSApiTest.php b/test/Api/TransactionalSMSApiTest.php index e39309cb..6f81b5e4 100644 --- a/test/Api/TransactionalSMSApiTest.php +++ b/test/Api/TransactionalSMSApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Api/WebhooksApiTest.php b/test/Api/WebhooksApiTest.php index 1f976e5d..4de5bbd9 100644 --- a/test/Api/WebhooksApiTest.php +++ b/test/Api/WebhooksApiTest.php @@ -17,7 +17,7 @@ * 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 */ /** @@ -29,7 +29,6 @@ namespace SendinBlue\Client; use \SendinBlue\Client\Configuration; -use \SendinBlue\Client\ApiClient; use \SendinBlue\Client\ApiException; use \SendinBlue\Client\ObjectSerializer; diff --git a/test/Model/AddContactToListTest.php b/test/Model/AddContactToListTest.php index 61127def..b8b444a2 100644 --- a/test/Model/AddContactToListTest.php +++ b/test/Model/AddContactToListTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/AddCreditsTest.php b/test/Model/AddCreditsTest.php index f3929af7..3f1fecd2 100644 --- a/test/Model/AddCreditsTest.php +++ b/test/Model/AddCreditsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateAttributeEnumerationTest.php b/test/Model/CreateAttributeEnumerationTest.php index f458085e..b11b7a25 100644 --- a/test/Model/CreateAttributeEnumerationTest.php +++ b/test/Model/CreateAttributeEnumerationTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateAttributeTest.php b/test/Model/CreateAttributeTest.php index a8d137be..fa5cc0a6 100644 --- a/test/Model/CreateAttributeTest.php +++ b/test/Model/CreateAttributeTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateChildTest.php b/test/Model/CreateChildTest.php index 6a98fa59..73273696 100644 --- a/test/Model/CreateChildTest.php +++ b/test/Model/CreateChildTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateContactTest.php b/test/Model/CreateContactTest.php index bdbd7a6a..255a4022 100644 --- a/test/Model/CreateContactTest.php +++ b/test/Model/CreateContactTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateEmailCampaignRecipientsTest.php b/test/Model/CreateEmailCampaignRecipientsTest.php index af3a8200..3d5a3b89 100644 --- a/test/Model/CreateEmailCampaignRecipientsTest.php +++ b/test/Model/CreateEmailCampaignRecipientsTest.php @@ -18,7 +18,7 @@ * 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 */ /** @@ -33,7 +33,7 @@ * CreateEmailCampaignRecipientsTest Class Doc Comment * * @category Class */ -// * @description CreateEmailCampaignRecipients +// * @description List ids to include/exclude from campaign /** * @package SendinBlue\Client * @author Swagger Codegen team diff --git a/test/Model/CreateEmailCampaignSenderTest.php b/test/Model/CreateEmailCampaignSenderTest.php index a689b950..c18ea239 100644 --- a/test/Model/CreateEmailCampaignSenderTest.php +++ b/test/Model/CreateEmailCampaignSenderTest.php @@ -18,7 +18,7 @@ * 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 */ /** @@ -33,7 +33,7 @@ * CreateEmailCampaignSenderTest Class Doc Comment * * @category Class */ -// * @description CreateEmailCampaignSender +// * @description Sender details including email and name (optional). For example {'name':'xyz' , 'email':'example@abc.com'} /** * @package SendinBlue\Client * @author Swagger Codegen team diff --git a/test/Model/CreateEmailCampaignTest.php b/test/Model/CreateEmailCampaignTest.php index 96a81b90..6123e39a 100644 --- a/test/Model/CreateEmailCampaignTest.php +++ b/test/Model/CreateEmailCampaignTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateListTest.php b/test/Model/CreateListTest.php index f1fc95db..479def53 100644 --- a/test/Model/CreateListTest.php +++ b/test/Model/CreateListTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateModelTest.php b/test/Model/CreateModelTest.php index 759de7f3..8d4c292a 100644 --- a/test/Model/CreateModelTest.php +++ b/test/Model/CreateModelTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateResellerTest.php b/test/Model/CreateResellerTest.php index e8ba9213..fe5303b9 100644 --- a/test/Model/CreateResellerTest.php +++ b/test/Model/CreateResellerTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateSenderIpsTest.php b/test/Model/CreateSenderIpsTest.php index 99de5677..1b3135b4 100644 --- a/test/Model/CreateSenderIpsTest.php +++ b/test/Model/CreateSenderIpsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateSenderModelTest.php b/test/Model/CreateSenderModelTest.php index 10e3b2f3..e720fa24 100644 --- a/test/Model/CreateSenderModelTest.php +++ b/test/Model/CreateSenderModelTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateSenderTest.php b/test/Model/CreateSenderTest.php index 122819f7..ac809b8b 100644 --- a/test/Model/CreateSenderTest.php +++ b/test/Model/CreateSenderTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateSmsCampaignRecipientsTest.php b/test/Model/CreateSmsCampaignRecipientsTest.php index a6e0590f..e0dabba7 100644 --- a/test/Model/CreateSmsCampaignRecipientsTest.php +++ b/test/Model/CreateSmsCampaignRecipientsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateSmsCampaignTest.php b/test/Model/CreateSmsCampaignTest.php index 6ef82a85..336081cd 100644 --- a/test/Model/CreateSmsCampaignTest.php +++ b/test/Model/CreateSmsCampaignTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateSmtpEmailTest.php b/test/Model/CreateSmtpEmailTest.php index 146df90b..c4700485 100644 --- a/test/Model/CreateSmtpEmailTest.php +++ b/test/Model/CreateSmtpEmailTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateSmtpTemplateSenderTest.php b/test/Model/CreateSmtpTemplateSenderTest.php index 6e5fb09e..ee28d830 100644 --- a/test/Model/CreateSmtpTemplateSenderTest.php +++ b/test/Model/CreateSmtpTemplateSenderTest.php @@ -18,7 +18,7 @@ * 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 */ /** @@ -33,7 +33,7 @@ * CreateSmtpTemplateSenderTest Class Doc Comment * * @category Class */ -// * @description CreateSmtpTemplateSender +// * @description Sender details including email and name (optional). For example {'name':'xyz' , 'email':'example@abc.com'} /** * @package SendinBlue\Client * @author Swagger Codegen team diff --git a/test/Model/CreateSmtpTemplateTest.php b/test/Model/CreateSmtpTemplateTest.php index 86bee5ad..e3b357b1 100644 --- a/test/Model/CreateSmtpTemplateTest.php +++ b/test/Model/CreateSmtpTemplateTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateUpdateFolderTest.php b/test/Model/CreateUpdateFolderTest.php index ccb07e81..aaac9135 100644 --- a/test/Model/CreateUpdateFolderTest.php +++ b/test/Model/CreateUpdateFolderTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreateWebhookTest.php b/test/Model/CreateWebhookTest.php index 7c952aa7..dd260538 100644 --- a/test/Model/CreateWebhookTest.php +++ b/test/Model/CreateWebhookTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/CreatedProcessIdTest.php b/test/Model/CreatedProcessIdTest.php index 8d8a46c6..d847769b 100644 --- a/test/Model/CreatedProcessIdTest.php +++ b/test/Model/CreatedProcessIdTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/DeleteHardbouncesTest.php b/test/Model/DeleteHardbouncesTest.php index c599ae4e..05fa4b0a 100644 --- a/test/Model/DeleteHardbouncesTest.php +++ b/test/Model/DeleteHardbouncesTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/EmailExportRecipientsTest.php b/test/Model/EmailExportRecipientsTest.php index 54415e93..99ec98c8 100644 --- a/test/Model/EmailExportRecipientsTest.php +++ b/test/Model/EmailExportRecipientsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/ErrorModelTest.php b/test/Model/ErrorModelTest.php index ff8df51c..1278355f 100644 --- a/test/Model/ErrorModelTest.php +++ b/test/Model/ErrorModelTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAccountMarketingAutomationTest.php b/test/Model/GetAccountMarketingAutomationTest.php index 53dfe6a4..8abcea93 100644 --- a/test/Model/GetAccountMarketingAutomationTest.php +++ b/test/Model/GetAccountMarketingAutomationTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAccountPlanTest.php b/test/Model/GetAccountPlanTest.php index 52afc2a4..ebb7bf93 100644 --- a/test/Model/GetAccountPlanTest.php +++ b/test/Model/GetAccountPlanTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAccountRelayDataTest.php b/test/Model/GetAccountRelayDataTest.php index 5144d0ac..49a43f9e 100644 --- a/test/Model/GetAccountRelayDataTest.php +++ b/test/Model/GetAccountRelayDataTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAccountRelayTest.php b/test/Model/GetAccountRelayTest.php index 233b17c9..84a32ace 100644 --- a/test/Model/GetAccountRelayTest.php +++ b/test/Model/GetAccountRelayTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAccountTest.php b/test/Model/GetAccountTest.php index 79a4e460..c12a9dc1 100644 --- a/test/Model/GetAccountTest.php +++ b/test/Model/GetAccountTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAggregatedReportTest.php b/test/Model/GetAggregatedReportTest.php index 27de7267..011e17a0 100644 --- a/test/Model/GetAggregatedReportTest.php +++ b/test/Model/GetAggregatedReportTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAttributesAttributesTest.php b/test/Model/GetAttributesAttributesTest.php index 0881479a..bed756e9 100644 --- a/test/Model/GetAttributesAttributesTest.php +++ b/test/Model/GetAttributesAttributesTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAttributesEnumerationTest.php b/test/Model/GetAttributesEnumerationTest.php index f1a5b7c1..f20ea0e4 100644 --- a/test/Model/GetAttributesEnumerationTest.php +++ b/test/Model/GetAttributesEnumerationTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetAttributesTest.php b/test/Model/GetAttributesTest.php index e9dca577..d34d43d4 100644 --- a/test/Model/GetAttributesTest.php +++ b/test/Model/GetAttributesTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetCampaignOverviewTest.php b/test/Model/GetCampaignOverviewTest.php index c0d11a7d..2d26ab59 100644 --- a/test/Model/GetCampaignOverviewTest.php +++ b/test/Model/GetCampaignOverviewTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetCampaignRecipientsTest.php b/test/Model/GetCampaignRecipientsTest.php index deabd200..9669f8e2 100644 --- a/test/Model/GetCampaignRecipientsTest.php +++ b/test/Model/GetCampaignRecipientsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetCampaignStatsTest.php b/test/Model/GetCampaignStatsTest.php index e10c6529..fe1990f9 100644 --- a/test/Model/GetCampaignStatsTest.php +++ b/test/Model/GetCampaignStatsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetChildInfoApiKeysTest.php b/test/Model/GetChildInfoApiKeysTest.php index 69938b31..6913eac5 100644 --- a/test/Model/GetChildInfoApiKeysTest.php +++ b/test/Model/GetChildInfoApiKeysTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetChildInfoApiKeysV2Test.php b/test/Model/GetChildInfoApiKeysV2Test.php index 8b81aa76..e2e359b9 100644 --- a/test/Model/GetChildInfoApiKeysV2Test.php +++ b/test/Model/GetChildInfoApiKeysV2Test.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetChildInfoApiKeysV3Test.php b/test/Model/GetChildInfoApiKeysV3Test.php index 0bb8d327..594dde45 100644 --- a/test/Model/GetChildInfoApiKeysV3Test.php +++ b/test/Model/GetChildInfoApiKeysV3Test.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetChildInfoCreditsTest.php b/test/Model/GetChildInfoCreditsTest.php index 89ebd762..244f6984 100644 --- a/test/Model/GetChildInfoCreditsTest.php +++ b/test/Model/GetChildInfoCreditsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetChildInfoStatisticsTest.php b/test/Model/GetChildInfoStatisticsTest.php index 5a96062d..ffa2ff91 100644 --- a/test/Model/GetChildInfoStatisticsTest.php +++ b/test/Model/GetChildInfoStatisticsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetChildInfoTest.php b/test/Model/GetChildInfoTest.php index 9c2c0460..aff039b6 100644 --- a/test/Model/GetChildInfoTest.php +++ b/test/Model/GetChildInfoTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetChildrenListTest.php b/test/Model/GetChildrenListTest.php index 2070ea8c..10b037b5 100644 --- a/test/Model/GetChildrenListTest.php +++ b/test/Model/GetChildrenListTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetClientTest.php b/test/Model/GetClientTest.php index 79162812..e88f3097 100644 --- a/test/Model/GetClientTest.php +++ b/test/Model/GetClientTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetContactCampaignStatsClickedTest.php b/test/Model/GetContactCampaignStatsClickedTest.php index 1de6e3c2..0401e554 100644 --- a/test/Model/GetContactCampaignStatsClickedTest.php +++ b/test/Model/GetContactCampaignStatsClickedTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetContactCampaignStatsOpenedTest.php b/test/Model/GetContactCampaignStatsOpenedTest.php index e9109a7f..ee610933 100644 --- a/test/Model/GetContactCampaignStatsOpenedTest.php +++ b/test/Model/GetContactCampaignStatsOpenedTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetContactCampaignStatsTest.php b/test/Model/GetContactCampaignStatsTest.php index 10fd0e08..98bdd8f8 100644 --- a/test/Model/GetContactCampaignStatsTest.php +++ b/test/Model/GetContactCampaignStatsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetContactCampaignStatsTransacAttributesTest.php b/test/Model/GetContactCampaignStatsTransacAttributesTest.php index 14a0466f..52663638 100644 --- a/test/Model/GetContactCampaignStatsTransacAttributesTest.php +++ b/test/Model/GetContactCampaignStatsTransacAttributesTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetContactCampaignStatsUnsubscriptionsTest.php b/test/Model/GetContactCampaignStatsUnsubscriptionsTest.php index 95057fb1..e8411592 100644 --- a/test/Model/GetContactCampaignStatsUnsubscriptionsTest.php +++ b/test/Model/GetContactCampaignStatsUnsubscriptionsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetContactDetailsTest.php b/test/Model/GetContactDetailsTest.php index 610d6890..3a15870e 100644 --- a/test/Model/GetContactDetailsTest.php +++ b/test/Model/GetContactDetailsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetContactsTest.php b/test/Model/GetContactsTest.php index b9f3a1fd..c9b69a7f 100644 --- a/test/Model/GetContactsTest.php +++ b/test/Model/GetContactsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetEmailCampaignTest.php b/test/Model/GetEmailCampaignTest.php index 6e12f0cf..062a8112 100644 --- a/test/Model/GetEmailCampaignTest.php +++ b/test/Model/GetEmailCampaignTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetEmailCampaignsTest.php b/test/Model/GetEmailCampaignsTest.php index 45d49f35..7a7ba35c 100644 --- a/test/Model/GetEmailCampaignsTest.php +++ b/test/Model/GetEmailCampaignsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetEmailEventReportEventsTest.php b/test/Model/GetEmailEventReportEventsTest.php index 3fe3a90f..004cbe84 100644 --- a/test/Model/GetEmailEventReportEventsTest.php +++ b/test/Model/GetEmailEventReportEventsTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetEmailEventReportTest.php b/test/Model/GetEmailEventReportTest.php index 297d5333..5cb6ee97 100644 --- a/test/Model/GetEmailEventReportTest.php +++ b/test/Model/GetEmailEventReportTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetExtendedCampaignOverviewSenderTest.php b/test/Model/GetExtendedCampaignOverviewSenderTest.php index e7fc5da4..c4eeea94 100644 --- a/test/Model/GetExtendedCampaignOverviewSenderTest.php +++ b/test/Model/GetExtendedCampaignOverviewSenderTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetExtendedCampaignOverviewTest.php b/test/Model/GetExtendedCampaignOverviewTest.php index e639140a..cd97db0a 100644 --- a/test/Model/GetExtendedCampaignOverviewTest.php +++ b/test/Model/GetExtendedCampaignOverviewTest.php @@ -18,7 +18,7 @@ * 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 */ /** diff --git a/test/Model/GetExtendedCampaignStatsLinksStatsTest.php b/test/Model/GetExtendedCampaignStatsLinksStatsTest.php deleted file mode 100644 index e544511a..00000000 --- a/test/Model/GetExtendedCampaignStatsLinksStatsTest.php +++ /dev/null @@ -1,86 +0,0 @@ -